Comments (3)
Hi @orionlee !
Thanks for the detailed report - I'm not certain pytest-socket will play nice with pytest-remotedata - as we both want to control the behavior of socket.*
. I haven't heard of that plugin until now, so it's entirely possible that there's conflict between the behavior of --disable-socket
and whatever remote data is doing.
You mentioned that you tried disabling that plugin, can you share how? From the CI results it looks like this is the commit that's being run - and that's passing --disable-socket
globally - unless I'm misreading something?
from pytest-socket.
-
My understanding is that
pytest-remotedata
does not control sockets. It really is a test filter trick so that for tests marked with@pytest.mark.remote_data
are skipped by default, unless--remote-data
is passed as an argument topytest
.
Typically you'd mark a test requiring network access with@pytest.mark.remote_data
so they are skipped by default. But it doesn't really care if the tests require network or not.
E.g., technically one can use it to distinguish short and long tests. If one marks all the long-running tests with remote_data,pytest
would by default run the short regression test. -
Regarding the CI results: while
--disable-socket
is passed to many runs, the specific run, pytest-linux (3.8-remote-data), does not have--disable-socket
. It ran with the following command:
poetry run pytest --remote-data --doctest-modules
The run is intended to be a normal full test that uses networks. But somehow many tests failed with pytest_socket.SocketBlockedError
. So pytest_socket still intercepted the tests, despite --disable-socket
was not passed in the command line. As an example, see line 109 of the run's log.
Regarding disable pytest-remotedata
: I did it with a brute force way (to be sure it is not there). In my local environment, I temporarily uninstalled the plugin from my conda environment, and did not pass --remote-data
in invoking pytest.
from pytest-socket.
Hey @orionlee !
I've changed some of the core internals of the plugin - most importantly that we no longer use an autouse
fixture, rather leverage the setup step of pytest to configure each test.
This ought to be released in 0.50.0 soon, and I hope you try it out!
Closing this issue, feel free to reopen if this doesn't work out!
from pytest-socket.
Related Issues (20)
- Incompatibility with pytest-flakes? HOT 2
- `remove_host_restrictions` functionality no longer in the public interface HOT 3
- 0.5.0: pytest is failing in `tests/test_async.py::test_starlette` unit HOT 4
- pytest-socket blocks retrieving other dependencies HOT 1
- Issue with sockets when trying to run Home Assistant tests HOT 2
- 0.5.1: pytest is failing in `tests/test_async.py::test_httpx_fails` unit HOT 11
- Question about asynctest and Python 3.8+ compatibility HOT 3
- Action Required: Fix Renovate Configuration
- dd-trace calls in separate thread do not fail test HOT 7
- Allow host masks HOT 2
- Allow private networks only HOT 5
- Issue with latest pytest-socket version while using testcontainers HOT 6
- Try replacement for httpbin HOT 1
- Do not install files directly to site-packages HOT 2
- --allow-hosts list is normalized but connection host is not HOT 5
- Update Python version support HOT 1
- vscode-python version 2023.20.0 breaks disable_socket expected behavior HOT 2
- Option to only block `connect` calls? HOT 2
- 0.7.0: test suite fails HOT 6
- Add similar mock
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest-socket.