Skip to content

Navigation Menu

Sign in
Sign up

Add offline mode to skip tests that require an internet connection - #135

Open
Luflosi wants to merge 1 commit into
webrecorder:master from
Luflosi:offline-tests
Open

Add offline mode to skip tests that require an internet connection #135
Luflosi wants to merge 1 commit into
webrecorder:master from
Luflosi:offline-tests

Conversation

@Luflosi

@Luflosi Luflosi commented Oct 1, 2021

Copy link
Copy Markdown

Closes #133.

I found a way to make make skipping the tests very elegant, requiring only @mark.online().
This comes at the expense of a little more code in conftest.py, the use of the get_closest_marker() function, which seems a bit hacky IMO and the additional file pytest.ini at the root of the project which registers the custom mark to avoid a warning.
If you think this is not worth it, I can just change this PR to skip the tests like in the APIO example.
I marked this PR as a draft to better indicate that I need your opinion on how to do this.

machawk1 reacted with thumbs up emoji

ikreymer commented Oct 5, 2021

Copy link
Copy Markdown
Member

Thanks! I think that looks reasonable, and actually instead of pytest.ini, you can just add it to conftest.py so its all in one place. I think the following should work:

def pytest_configure(config):
 config.addinivalue_line(
 "markers", "online: marks tests as requiring an internet connection"
 )

Luflosi marked this pull request as ready for review October 6, 2021 08:55

Luflosi commented Oct 6, 2021

Copy link
Copy Markdown
Author

Yes, that works, thanks. Please review.

Luflosi commented Nov 11, 2021

Copy link
Copy Markdown
Author

Do you maybe have some time to review this please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Offline tests

2 participants

AltStyle によって変換されたページ (->オリジナル) /