Comments (7)
Can you try running against master
and let me know if that fixes the issue?
from freezegun.
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.
I wanted to make sure I documented this stack overflow question that explains the problem.
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.
Is there any update on this?
from freezegun.
No, I haven't had any time. We can try to use whatever logic the decorator package uses.
from freezegun.
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.
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)
- utcnow is deprecated HOT 1
- Add parameter to increase speed of time when tick=True
- `time_to_freeze.today()` returns wrong time and type if TZ is not 'UTC' in env vars HOT 2
- 'FakeDatetime' object cannot be interpreted as an integer
- Timezone America/Sao_Paulo triggers recursion errors in tests. HOT 3
- Maintenance plans HOT 3
- 1.3.0: `freezegun/__init__.py` is missing new version number HOT 1
- [Discussion] about freezing asyncio HOT 7
- ``PermissionError: [Errno 1] Operation not permitted`` appears when upgrading to ``1.3.0`` HOT 7
- Freezegun doesn't mock pointers to date functions HOT 1
- Tag for 1.2.2 is missing HOT 1
- Python 3.12: Deprecation warnings related to datetime.datetime.utcfromtimestamp HOT 2
- Time is not freezed when using `uvloop` event loop
- unsupported operand type(s) for +: 'FakeDatetime' and 'FakeDatetime'
- Datetime and Time packages do not have the same behavior when being frozen HOT 4
- timezone free datetime.datetime.fromtimestamp returns original datetime.datetime HOT 1
- Adding a return value to tick()
- Could have some problem with Django with TIME_ZONE setting
- Test regressions on Python 3.13.0b1 HOT 2
- `FakeDatetime`'s `timestamp()` is not consistent with `datetime().timestamp()` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freezegun.