Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark sklearn tests #1202

Merged
merged 15 commits into from
Feb 23, 2023
Merged
13 changes: 11 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ on: [push, pull_request]

jobs:
test:
name: (${{ matrix.os }}, Py${{ matrix.python-version }}, sk${{ matrix.scikit-learn }})
name: (${{ matrix.os }}, Py${{ matrix.python-version }}, sk${{ matrix.scikit-learn }}, sk-only:${{ matrix.sklearn-only }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
scikit-learn: [0.21.2, 0.22.2, 0.23.1, 0.24]
os: [ubuntu-latest]
sklearn-only: ['true']
exclude: # no scikit-learn 0.21.2 release for Python 3.8
- python-version: 3.8
scikit-learn: 0.21.2
Expand All @@ -19,17 +20,22 @@ jobs:
scikit-learn: 0.18.2
scipy: 1.2.0
os: ubuntu-latest
sklearn-only: 'true'
- python-version: 3.6
scikit-learn: 0.19.2
os: ubuntu-latest
sklearn-only: 'true'
- python-version: 3.6
scikit-learn: 0.20.2
os: ubuntu-latest
sklearn-only: 'true'
- python-version: 3.8
scikit-learn: 0.23.1
code-cov: true
sklearn-only: 'false'
os: ubuntu-latest
- os: windows-latest
sklearn-only: 'false'
scikit-learn: 0.24.*
fail-fast: false
max-parallel: 4
Expand Down Expand Up @@ -62,7 +68,10 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: |
if [ ${{ matrix.code-cov }} ]; then codecov='--cov=openml --long --cov-report=xml'; fi
pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov --reruns 5 --reruns-delay 1
# Most of the time, running only the scikit-learn tests is sufficient
if [ ${{ matrix.sklearn-only }} = 'true' ]; then sklearn='-m sklearn'; fi
echo pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov $sklearn --reruns 5 --reruns-delay 1
pytest -n 4 --durations=20 --timeout=600 --timeout-method=thread --dist load -sv $codecov $sklearn --reruns 5 --reruns-delay 1
- name: Run tests on Windows
if: matrix.os == 'windows-latest'
run: | # we need a separate step because of the bash-specific if-statement in the previous one.
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ following rules before you submit a pull request:

- Add [unit tests](https://github.com/openml/openml-python/tree/develop/tests) and [examples](https://github.com/openml/openml-python/tree/develop/examples) for any new functionality being introduced.
- If an unit test contains an upload to the test server, please ensure that it is followed by a file collection for deletion, to prevent the test server from bulking up. For example, `TestBase._mark_entity_for_removal('data', dataset.dataset_id)`, `TestBase._mark_entity_for_removal('flow', (flow.flow_id, flow.name))`.
- Please ensure that the example is run on the test server by beginning with the call to `openml.config.start_using_configuration_for_example()`.
- Please ensure that the example is run on the test server by beginning with the call to `openml.config.start_using_configuration_for_example()`.
- Add the `@pytest.mark.sklearn` marker to your unit tests if they have a dependency on scikit-learn.

- All tests pass when running `pytest`. On
Unix-like systems, check with (from the toplevel source folder):
Expand Down
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ def pytest_sessionfinish() -> None:
logger.info("{} is killed".format(worker))


def pytest_configure(config):
config.addinivalue_line("markers", "sklearn: marks tests that use scikit-learn")


def pytest_addoption(parser):
parser.addoption(
"--long",
Expand Down
Loading