question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failing to freeze with pytest

See original GitHub issue

Stack trace below. Under python 2.7.17.

In [3]: from freezegun import freeze_time

In [4]: freezer = freeze_time("2012-01-14 12:00:01")

In [5]: freezer.start()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/Users/leonsas/Projects/Hypnos/hypnos/sleep_plan/plan_review.pyc in <module>()
----> 1 freezer.start()

/usr/local/lib/python2.7/site-packages/freezegun/api.pyc in start(self)
    381             elif (not hasattr(module, "__name__") or module.__name__ in ('datetime', 'time')):
    382                 continue
--> 383             for module_attribute in dir(module):
    384                 if module_attribute in real_names:
    385                     continue

TypeError: py.test.cmdline.__dict__ is not a dictionary

And seems like cmdline is None:

In [12]: import py.test.cmdline

In [13]: type(py.test.cmdline)
Out[13]: NoneType

Not sure exactly what’s going on. Happy to give more environment context to figure this out.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
poulainvcommented, Aug 18, 2016

Same issue! Any idea?

0reactions
spuleccommented, Mar 6, 2018

I’m going to close. Feel free to reopen with a script to reproduce this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

py.test freezes after collecting items - Stack Overflow
py.test freezes after collecting items · 2. Can you try running test-by-test (using -k test_name) to see if this caused by any single...
Read more >
pytest stuck after assertion fail · Issue #7989 - GitHub
Detailed Description I'm writing pytest test cases for aiosmtpd, and I'm hitting this problem against master in aio-libs/aiosmtpd Minimal ...
Read more >
That FreezeGun doesn't work with Pytest fixtures (unless you ...
That is, this test fails when run on any date other than 2021-07-01: import datetime import freezegun import pytest @pytest.fixture() def ...
Read more >
How To Debug A Hanging Test Using Pytest - PyBites
Today a wanted to share a neat trick that might save you some headache: debugging a hanging test.
Read more >
pytest-freeze-reqs - PyPI
Pytest plugin that tests if requirements are frozen. **/req*.txt and **/req*.pip are the patterns of path to match. ok and not ok lines...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found