GithubHelp home page GithubHelp logo

Comments (3)

miketheman avatar miketheman commented on June 6, 2024

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.

orionlee avatar orionlee commented on June 6, 2024
  1. 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 to pytest.
    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.

  2. 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.

miketheman avatar miketheman commented on June 6, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.