Skip to content
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

Allow skipping test cases that need Internet access #16

Merged
merged 1 commit into from
Apr 26, 2022

Conversation

bdrung
Copy link
Contributor

@bdrung bdrung commented Apr 15, 2022

Support skipping all test cases that access the Internet by setting the environment variable NO_INTERNET. This is useful to make the test run reproducible and robust for future runs (to avoid breaking in case some random service on the Internet changes).

@bdrung bdrung requested a review from a team as a code owner April 15, 2022 20:55
@bdrung bdrung requested a review from garethgreenaway April 15, 2022 20:55
bdrung added a commit to bdrung/pytest-skip-markers that referenced this pull request Apr 15, 2022
Mark test cases that need Internet access and allow skipping them by
setting the environment variable `NO_INTERNET`.

Forwarded: saltstack#16
Signed-off-by: Benjamin Drung <bdrung@debian.org>
@bdrung bdrung force-pushed the support-preventing-internet-access branch 2 times, most recently from f3e9404 to 3320fe9 Compare April 15, 2022 21:17
bdrung added a commit to bdrung/pytest-skip-markers that referenced this pull request Apr 15, 2022
Mark test cases that need Internet access and allow skipping them by
setting the environment variable `NO_INTERNET`.

Forwarded: saltstack#16
Signed-off-by: Benjamin Drung <bdrung@debian.org>
Copy link
Contributor

@s0undt3ch s0undt3ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a changelog/16.feature.rst file explaining the new feature added.

Also, could you elaborate on the use case for this?

tests/unit/utils/markers/test_skip_if_no_remote_network.py Outdated Show resolved Hide resolved
@s0undt3ch s0undt3ch force-pushed the support-preventing-internet-access branch from 3320fe9 to 9858e3a Compare April 16, 2022 06:26
@codecov
Copy link

codecov bot commented Apr 16, 2022

Codecov Report

Merging #16 (8b6960f) into main (7665312) will decrease coverage by 12.17%.
The diff coverage is 63.01%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main      #16       +/-   ##
===========================================
- Coverage   93.09%   80.92%   -12.16%     
===========================================
  Files          43       53       +10     
  Lines        1605     2463      +858     
===========================================
+ Hits         1494     1993      +499     
- Misses        111      470      +359     
Flag Coverage Δ
Linux ?
Py35 ?
Py36 ?
Py37 ?
Py38 ?
Py39 ?
PyTest60 ?
PyTest61 ?
PyTest62 ?
Windows ?
macOS ?
src 66.72% <58.50%> (-16.33%) ⬇️
tests 99.91% <100.00%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/pytestskipmarkers/utils/socket.py 100.00% <ø> (ø)
tests/conftest.py 87.50% <ø> (-12.50%) ⬇️
tests/functional/test_destructive_test.py 100.00% <ø> (ø)
tests/functional/test_expensive_test.py 100.00% <ø> (ø)
tests/functional/test_requires_network.py 100.00% <ø> (ø)
tests/functional/test_skip_if_not_root.py 100.00% <ø> (ø)
tests/functional/test_skip_on_aarch64.py 100.00% <ø> (ø)
tests/functional/test_skip_on_aix.py 100.00% <ø> (ø)
tests/functional/test_skip_on_darwin.py 100.00% <ø> (ø)
tests/functional/test_skip_on_freebsd.py 100.00% <ø> (ø)
... and 44 more

@bdrung bdrung force-pushed the support-preventing-internet-access branch from e418b85 to ccc4aa4 Compare April 16, 2022 10:33
Support skipping all test cases that access the Internet by setting the
environment variable `NO_INTERNET`. This is useful to make the test run
reproducible and robust for future runs (to avoid breaking in case some
random service on the Internet changes).

Signed-off-by: Benjamin Drung <bdrung@debian.org>
Co-authored-by: Pedro Algarvio <pedro@algarvio.me>
@bdrung bdrung force-pushed the support-preventing-internet-access branch from ccc4aa4 to 8b6960f Compare April 16, 2022 10:34
@bdrung
Copy link
Contributor Author

bdrung commented Apr 16, 2022

Added changelog/16.feature.rst and updated commit message plus MR description. We want to set this environment variable during test run in Debian packages. Test in Debian packages / autopkgtest should not access the Internet (for the reason mentioned).

@s0undt3ch
Copy link
Contributor

Thank You!
I need to sort why the windows CI pipeline is failing and once I do, I'll push out a release.

@s0undt3ch s0undt3ch merged commit 72ae04c into saltstack:main Apr 26, 2022
@bdrung bdrung deleted the support-preventing-internet-access branch April 26, 2022 11:45
@s0undt3ch
Copy link
Contributor

Released on 1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants