Skip to content

Commit

Permalink
Ensure no remote connections during testing (#3328)
Browse files Browse the repository at this point in the history
As a way to prevent the test suite from making remote calls to anywhere
unexpected, use the `pytest-socket` plugin to disable any calls to
hosts other than localhost.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
  • Loading branch information
miketheman committed Feb 8, 2024
1 parent 12f9233 commit 25155d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ quart-trio==0.11.1
# https://github.com/pgjones/hypercorn/issues/169
hypercorn @ git+https://github.com/urllib3/hypercorn@urllib3-changes
httpx==0.25.2
pytest-socket==0.7.0
# CFFI is not going to support CPython 3.13 in an actual release until
# there is a release candidate for 3.13.
# https://github.com/python-cffi/cffi/issues/23#issuecomment-1845861410
cffi @ git+https://github.com/python-cffi/cffi@14723b0bbd127790c450945099db31018d80fa83; python_version == "3.13"

3 changes: 3 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ def tests_impl(
"--durations=10",
"--strict-config",
"--strict-markers",
"--disable-socket",
"--allow-unix-socket",
"--allow-hosts=localhost,::1,127.0.0.0,240.0.0.0", # See `TARPIT_HOST`
*pytest_extra_args,
*(session.posargs or ("test/",)),
env=pytest_session_envvars,
Expand Down

0 comments on commit 25155d7

Please sign in to comment.