Closed geographika closed 2 weeks ago
From comments in the merged pull request from @mgorny (to avoid these details being lost):
Move the OSHFixtures class into a pytest fixture to defer initializing it (and therefore accessing the Internet) until the relevant test functions are called. This makes it possible for pytest.mark.online to correctly skip them. It also avoids initializing the fixtures class multiple times -- now it should be initialized once per session.
While at it, move the global functions into the OSHFixtures class. It would need to access the class members anyway, and this seems cleaner than passing its instance explicitly.
This pull request makes use of the https://github.com/miketheman/pytest-socket/ plugin to check the test suite runs without network access. Relates to #951.
There is no simple way to mark doctests as requiring online access, or to disable the
--doctest-modules
flag from the command line, so I have manually deselected the 3 tests that require network access in the main.yml file.To ensure the test suite passes additional
@pytest.mark.online
have been added to tests requiring network access.tox.ini
was modified to put options on separate lines to improve readibility.