GithubHelp home page GithubHelp logo

Comments (4)

miketheman avatar miketheman commented on June 6, 2024

Thanks for the detailed report!

This seems like a logical bug, and I'll have to dig into it a bit more - since from the outset, I think it's confusing to the user that passing --allow-hosts=... without the --disable-socket isn't exactly the intended behavior either.

I can confirm that setting the .ini to:

[pytest]
addopts = --disable-socket --allow-hosts=127.0.0.1

and running the test, all 3 requests are blocked, since none of the target IPs match 127.0.0.1.

Can you help me understand what outcome you expected?

from pytest-socket.

fj-dt avatar fj-dt commented on June 6, 2024

Hello Mike.

I tried your configuration but it does the opposite of what I expect.

I expect that, by default it does not allow socket. So when I pass socket_enabled in my test, then they should be allowed.
In my example, the first one is not allowed, then the two others are. The three of them should be allowed since I used socket_enabled.

By adding --disable-socket things get worse, as none of them are allowed, although I have the socket_enabled as argument in my test. So I think you just found another issue.

from pytest-socket.

miketheman avatar miketheman commented on June 6, 2024

@fj-dt I wrote a test here: 3b61b28

If I read your desire correctly, you're expecting the inline socket_enabled to override the config setting, and allow those three remote calls, instead of failing all three?

from pytest-socket.

fj-dt avatar fj-dt commented on June 6, 2024

@miketheman Correct. 👍

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.