Giter VIP home page Giter VIP logo

Comments (5)

fredrikaverpil avatar fredrikaverpil commented on May 31, 2024

And/or perhaps we should use --with-isolation so that each test is indeed supposed to run separately from each other. We could then provide setup and teardown functions in tests.py in case something needs to be setup prior to the run and then teared down after the run.

@with_setup(setup_x, teardown_x)

I found this a nice resource explaining (with examples) how setup runs before the test and then teardown after the test: http://pythontesting.net/framework/nose/nose-introduction/

This seem to be sort of like a standard approach to using nose. And we kind of already use this approach, but the term clean makes it a little confusing in my mind. Perhaps it would be better to do the cleaning using --with-isolation and then use the decorator to provide setup/teardown when required.

from qt.py.

fredrikaverpil avatar fredrikaverpil commented on May 31, 2024

I'll set up a PR in case you think this is a good suggestion.

from qt.py.

mottosso avatar mottosso commented on May 31, 2024

Python does not support unloading modules

This is true, but it isn't really doing that. All it's doing is ensuring that Qt.py is re-read at each import and that any variables it reads are reset so that our tests can run it multiple times without affecting each other. It will likely only work in this unique case, and not so much with other modules (did you try with sip?).

And/or perhaps we should use --with-isolation so that each test is indeed supposed to run separately from each other.

As far as I can tell, --with-isolation does what you did in your example.

The isolation plugin resets the contents of sys.modules after running each test module or package. Link

But it's a good point. It would be good if each test could be completely isolated. As in, being their own process. I'm sure there's an option for this with nose, I just haven't experienced it.

from qt.py.

mottosso avatar mottosso commented on May 31, 2024

Maybe something like this could enable isolation.

from qt.py.

fredrikaverpil avatar fredrikaverpil commented on May 31, 2024

Nice find!
PR coming up...

from qt.py.

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.