Git Product home page Git Product logo

Comments (7)

spulec avatar spulec commented on June 17, 2024

Can you try running against master and let me know if that fixes the issue?

from freezegun.

nfelger avatar nfelger commented on June 17, 2024

Hm, looks like this fixes the first issue (discovering the test in the decorated class), but not the second one (mixing freezegun function decoration with py.test fixture dependency injection).

from freezegun.

spulec avatar spulec commented on June 17, 2024

I wanted to make sure I documented this stack overflow question that explains the problem.

http://stackoverflow.com/questions/19614658/how-do-i-make-pytest-fixtures-work-with-decorated-functions

I would prefer not to require the decorator package as a dependency, but there may not be a lot of other options. We can try to use some of the logic the package uses.

from freezegun.

nfelger avatar nfelger commented on June 17, 2024

Is there any update on this?

from freezegun.

spulec avatar spulec commented on June 17, 2024

No, I haven't had any time. We can try to use whatever logic the decorator package uses.

from freezegun.

pelme avatar pelme commented on June 17, 2024

pytest looks at the the __wrapped__ attribute to be able to inspect the original function.

Python 3.2 functools.wraps sets __wrapped__. mock uses the same mechanism to be compatible with pytest and just sets __wrapped__ for Python <3.2:
https://code.google.com/p/mock/source/browse/mock.py#79

from freezegun.

nfelger avatar nfelger commented on June 17, 2024

Thanks so much for putting in the time to fix this! I just tried applying this to our test suites, and it works perfectly and makes the tests so much easier to read. 😃

from freezegun.

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.