Skip to content

Commit

Permalink
Add test serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Shrews committed Jul 11, 2024
1 parent bdc0159 commit 75b525e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[pytest]
markers =
test_all_runtimes: Generate a test for each supported container runtime
serial: Tests that need to run serially
testpaths = test
addopts =
-r a
Expand Down
11 changes: 11 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,14 @@ def project_fixtures(tmp_path):
yield dest

shutil.rmtree(dest, ignore_errors=True)


def pytest_collection_modifyitems(session, config, items):
# mark serial items as skipped if it looks like we're running with some obvious kinds of parallelism
numproc = getattr(config.known_args_namespace, 'numprocesses', None)

if isinstance(numproc, int) and numproc > 1:
for serial_item in (i for i in items if any(i.iter_markers(name='serial'))):
serial_item.add_marker(
pytest.mark.skip(reason='test requires serial execution (add --numprocesses 0 to allow)')
)
4 changes: 4 additions & 0 deletions test/integration/test_transmit_worker_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ def test_remote_job_interface(self, tmp_path, project_fixtures, job_type):
incoming_buffer.close()
self.check_artifacts(str(process_dir), job_type)

# The keepalive tests will run serially since Python 3.13 somehow causes a longer delay
# in the tests, thus causing the keepalive timeout count to exceed the hardcoded value
# of 5.
@pytest.mark.serial
@pytest.mark.parametrize("keepalive_setting", [
0, # keepalive explicitly disabled, default
1, # emit keepalives every 1s
Expand Down

0 comments on commit 75b525e

Please sign in to comment.