Skip to content

CI: Run tests with available parallelism #1157

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

Merged
merged 2 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions nibabel/tests/test_api_validators.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" Metaclass and class for validating instance APIs
"""

import os
import pytest


class validator2test(type):
Expand Down Expand Up @@ -82,6 +83,10 @@ def validate_something(self, obj, params):
assert obj.get_var() == params['var']


@pytest.mark.xfail(
os.getenv("PYTEST_XDIST_WORKER") is not None,
reason="Execution in the same scope cannot be guaranteed"
)
class TestRunAllTests(ValidateAPI):
""" Class to test that each validator test gets run

Expand All @@ -98,7 +103,7 @@ def validate_first(self, obj, param):
def validate_second(self, obj, param):
self.run_tests.append('second')


def teardown():
# Check that both validate_xxx tests got run
assert TestRunAllTests.run_tests == ['first', 'second']
@classmethod
def teardown_class(cls):
# Check that both validate_xxx tests got run
assert cls.run_tests == ['first', 'second']
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ test =
pytest-cov
pytest-doctestplus
pytest-httpserver
pytest-xdist
zstd =
pyzstd >= 0.14.3
all =
Expand Down
2 changes: 1 addition & 1 deletion tools/ci/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ elif [ "${CHECK_TYPE}" == "test" ]; then
cd for_testing
cp ../.coveragerc .
pytest --doctest-modules --doctest-plus --cov nibabel --cov-report xml \
--junitxml=test-results.xml -v --pyargs nibabel
--junitxml=test-results.xml -v --pyargs nibabel -n auto
else
false
fi
Expand Down