Giter Site home page Giter Site logo

Comments (3)

nedbat avatar nedbat commented on August 17, 2024 1

I am upgrading the "one and only version of coverage" in the Meta monorepo

Wow, OK! Let me know if other issues arise.

from coveragepy.

nedbat avatar nedbat commented on August 17, 2024

I would rather not try to make coverage defensive against aggressive monkeypatching in tests. How hard would it be to update the test? If you could patch the fake implementation where you use glob instead of in the glob module itself, it will have a more localized effect.

from coveragepy.

itamaro avatar itamaro commented on August 17, 2024

How hard would it be to update the test?

That's definitely the right thing to do :)

I'm sure it's not that hard to fix the specific test (it will require overhauling the patching strategy in that test though).
For context, I am upgrading the "one and only version of coverage" in the Meta monorepo, so I am not an expert on most of the millions of the affected tests.

If you could patch the fake implementation where you use glob instead of in the glob module itself, it will have a more localized effect.

looks like the test was actually trying to do that. glob was being imported in app/util.py, and the test was patching app.util.glob.glob. I guess this is one of those mock footguns, where the right thing to patch was app.util.glob, and patching app.util.glob.glob actually patches the glob function in the builtin glob module.
Interestingly, even calling mocked_glob.stop() doesn't unpatch the builtin glob.glob... but that's definitely out of scope for a coverage-specific issue :)

In any case, I'm totally ok with this being closed as "not a bug" / "user doing clowny things"!

from coveragepy.

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.