diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 311c77d3..10ab4728 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -28,6 +28,10 @@ jobs: steps: - uses: actions/checkout@v6 + - run: git remote set-branches origin 'main' + + - run: git fetch --depth 1 + - name: Install uv uses: astral-sh/setup-uv@v7 with: diff --git a/pyproject.toml b/pyproject.toml index 7254f804..bf481a43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,6 +56,7 @@ dependencies = [ "einops>=0.6.0,<0.8.0", "fsspec>=2022.5.0,<2024.4.0; python_version == '3.8'", "rich", + "scikit-base", ] diff --git a/tests/test_autoint.py b/tests/test_autoint.py index 6f4b90b7..96bbe977 100644 --- a/tests/test_autoint.py +++ b/tests/test_autoint.py @@ -1,6 +1,7 @@ #!/usr/bin/env python """Tests for `pytorch_tabular` package.""" +from skbase.utils.git_diff import _is_module_changed import pytest from pytorch_tabular import TabularModel @@ -8,6 +9,10 @@ from pytorch_tabular.models import AutoIntConfig +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.autoint"), + reason="run test only if autoint module is changed", +) @pytest.mark.parametrize("multi_target", [True, False]) @pytest.mark.parametrize( "continuous_cols", [["AveRooms", "AveBedrms", "Population", "AveOccup", "Latitude", "Longitude"]] @@ -78,6 +83,10 @@ def test_regression( assert pred_df.shape[0] == test.shape[0] +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.autoint"), + reason="run test only if autoint module is changed", +) @pytest.mark.parametrize("multi_target", [False, True]) @pytest.mark.parametrize( "continuous_cols", diff --git a/tests/test_danet.py b/tests/test_danet.py index ac4e3861..cf202392 100644 --- a/tests/test_danet.py +++ b/tests/test_danet.py @@ -1,6 +1,7 @@ #!/usr/bin/env python """Tests for `pytorch_tabular` package.""" +from skbase.utils.git_diff import _is_module_changed import pytest from pytorch_tabular import TabularModel @@ -10,6 +11,10 @@ # from pytorch_tabular.categorical_encoders import CategoricalEmbeddingTransformer +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.danet"), + reason="run test only if danet module is changed", +) @pytest.mark.parametrize("multi_target", [True, False]) @pytest.mark.parametrize( "continuous_cols", @@ -80,6 +85,10 @@ def test_regression( assert pred_df.shape[0] == test.shape[0] +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.danet"), + reason="run test only if danet module is changed", +) @pytest.mark.parametrize("multi_target", [False, True]) @pytest.mark.parametrize( "continuous_cols", diff --git a/tests/test_ft_transformer.py b/tests/test_ft_transformer.py index dac827bd..4f8509a2 100644 --- a/tests/test_ft_transformer.py +++ b/tests/test_ft_transformer.py @@ -1,6 +1,7 @@ #!/usr/bin/env python """Tests for `pytorch_tabular` package.""" +from skbase.utils.git_diff import _is_module_changed import pytest from pytorch_tabular import TabularModel @@ -9,6 +10,10 @@ from pytorch_tabular.models import FTTransformerConfig +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.ft_transformer"), + reason="run test only if ft_transformer module is changed", +) @pytest.mark.parametrize("multi_target", [True, False]) @pytest.mark.parametrize( "continuous_cols", @@ -86,6 +91,10 @@ def test_regression( assert pred_df.shape[0] == test.shape[0] +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.ft_transformer"), + reason="run test only if ft_transformer module is changed", +) @pytest.mark.parametrize("multi_target", [False, True]) @pytest.mark.parametrize( "continuous_cols", diff --git a/tests/test_gandalf.py b/tests/test_gandalf.py index 374767fe..a61a135c 100644 --- a/tests/test_gandalf.py +++ b/tests/test_gandalf.py @@ -1,6 +1,7 @@ #!/usr/bin/env python """Tests for `pytorch_tabular` package.""" +from skbase.utils.git_diff import _is_module_changed import pytest from pytorch_tabular import TabularModel @@ -10,6 +11,10 @@ # from pytorch_tabular.categorical_encoders import CategoricalEmbeddingTransformer +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.gandalf"), + reason="run test only if gandalf module is changed", +) @pytest.mark.parametrize("multi_target", [True, False]) @pytest.mark.parametrize( "continuous_cols", @@ -80,6 +85,10 @@ def test_regression( assert pred_df.shape[0] == test.shape[0] +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.gandalf"), + reason="run test only if gandalf module is changed", +) @pytest.mark.parametrize("multi_target", [False, True]) @pytest.mark.parametrize( "continuous_cols", diff --git a/tests/test_gate.py b/tests/test_gate.py index c4c2693f..e7fb3bd3 100644 --- a/tests/test_gate.py +++ b/tests/test_gate.py @@ -1,6 +1,7 @@ #!/usr/bin/env python """Tests for `pytorch_tabular` package.""" +from skbase.utils.git_diff import _is_module_changed import pytest from pytorch_tabular import TabularModel @@ -10,6 +11,10 @@ # from pytorch_tabular.categorical_encoders import CategoricalEmbeddingTransformer +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.gate"), + reason="run test only if gate module is changed", +) @pytest.mark.parametrize("multi_target", [True, False]) @pytest.mark.parametrize( "continuous_cols", @@ -85,6 +90,10 @@ def test_regression( assert pred_df.shape[0] == test.shape[0] +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.gate"), + reason="run test only if gate module is changed", +) @pytest.mark.parametrize("multi_target", [False, True]) @pytest.mark.parametrize( "continuous_cols", diff --git a/tests/test_model_stacking.py b/tests/test_model_stacking.py index 629c19a4..1e986b71 100644 --- a/tests/test_model_stacking.py +++ b/tests/test_model_stacking.py @@ -1,4 +1,5 @@ import numpy as np +from skbase.utils.git_diff import _is_module_changed import pytest import torch from sklearn.preprocessing import PowerTransformer @@ -50,6 +51,10 @@ def get_model_configs(task): return [model_config(task) for model_config in all_model_configs] +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.stacking"), + reason="run test only if stacking module is changed", +) @pytest.mark.parametrize("multi_target", [True, False]) @pytest.mark.parametrize( "continuous_cols", @@ -163,6 +168,10 @@ def test_regression( assert pred_df.shape[0] == test.shape[0] +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.stacking"), + reason="run test only if stacking module is changed", +) @pytest.mark.parametrize("multi_target", [False, True]) @pytest.mark.parametrize( "continuous_cols", diff --git a/tests/test_tabnet.py b/tests/test_tabnet.py index 1524aa6d..0dcdbfca 100644 --- a/tests/test_tabnet.py +++ b/tests/test_tabnet.py @@ -1,6 +1,7 @@ #!/usr/bin/env python """Tests for `pytorch_tabular` package.""" +from skbase.utils.git_diff import _is_module_changed import pytest from pytorch_tabular import TabularModel @@ -8,6 +9,10 @@ from pytorch_tabular.models import TabNetModelConfig +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.tabnet"), + reason="run test only if tabnet module is changed", +) @pytest.mark.parametrize("multi_target", [True, False]) @pytest.mark.parametrize( "continuous_cols", @@ -78,6 +83,10 @@ def test_regression( assert pred_df.shape[0] == test.shape[0] +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.tabnet"), + reason="run test only if tabnet module is changed", +) @pytest.mark.parametrize("multi_target", [False, True]) @pytest.mark.parametrize( "continuous_cols", diff --git a/tests/test_tabtransformer.py b/tests/test_tabtransformer.py index aa3c644f..58bb5cbc 100644 --- a/tests/test_tabtransformer.py +++ b/tests/test_tabtransformer.py @@ -1,6 +1,7 @@ #!/usr/bin/env python """Tests for `pytorch_tabular` package.""" +from skbase.utils.git_diff import _is_module_changed import pytest from pytorch_tabular import TabularModel @@ -9,6 +10,10 @@ from pytorch_tabular.models import TabTransformerConfig +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.tab_transformer"), + reason="run test only if tab_transformer module is changed", +) @pytest.mark.parametrize("multi_target", [True, False]) @pytest.mark.parametrize( "continuous_cols", @@ -84,6 +89,10 @@ def test_regression( assert pred_df.shape[0] == test.shape[0] +@pytest.mark.skipif( + not _is_module_changed("pytorch_tabular.models.tab_transformer"), + reason="run test only if tab_transformer module is changed", +) @pytest.mark.parametrize("multi_target", [False, True]) @pytest.mark.parametrize( "continuous_cols",