GithubHelp home page GithubHelp logo

Comments (8)

jayvdb avatar jayvdb commented on June 14, 2024 1

OK, well this plugin claims to be blocking socket, but it isnt blocking socket.getaddrinfo , and possibly a few other bits which could be useful.

This extra socket blocking could be exposed to the user either as

  • extra granularity, e.g. --disable-socket=socket,socket.connect,getaddrinfo,getfqdn,sethostname,etc , or
  • extra layers, e.g. --disable-name-lookup

from pytest-socket.

jayvdb avatar jayvdb commented on June 14, 2024

Turns out that this wont be especially helpful for my use-case unless it also intercepts name resolution, as that fails first, before sockets are opened.

from pytest-socket.

jayvdb avatar jayvdb commented on June 14, 2024

For name resolution, it should be relatively easy to wrap/block socket.getaddrinfo by overwriting it with a new function/class which achieves this.

And it looks like https://github.com/disqus/nose-socket-whitelist might do the trick

from pytest-socket.

miketheman avatar miketheman commented on June 14, 2024

That's an interesting approach, would you consider how this might apply as a config argument that makes sense to a user?

from pytest-socket.

miketheman avatar miketheman commented on June 14, 2024

I've thought more about this, and from a testing behavior, I'd prefer my test suite to fail if someone added a usage of a socket that wasn't expected, as then the test suite would pass providing a false sense of security.

I'll leave the issue open and tagged with "help wanted" if anyone wanted to work on this as an opt-in feature.

from pytest-socket.

jayvdb avatar jayvdb commented on June 14, 2024

I had envisioned this only as an opt-in.

from pytest-socket.

github-actions avatar github-actions commented on June 14, 2024

This issue is stale because it has been open for 90 days with no activity.

from pytest-socket.

github-actions avatar github-actions commented on June 14, 2024

This issue was closed because it has been inactive for 30 days since being marked as stale.

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.