conftest.py 545 B

12345678910111213141516171819202122
  1. import h5py
  2. import pytest
  3. @pytest.fixture()
  4. def writable_file(tmp_path):
  5. with h5py.File(tmp_path / 'test.h5', 'w') as f:
  6. yield f
  7. def pytest_addoption(parser):
  8. parser.addoption(
  9. '--no-network', action='store_true', default=False, help='No network access'
  10. )
  11. def pytest_collection_modifyitems(config, items):
  12. if config.getoption('--no-network'):
  13. nonet = pytest.mark.skip(reason='No Internet')
  14. for item in items:
  15. if 'network' in item.keywords:
  16. item.add_marker(nonet)