Coder Social home page Coder Social logo

Comments (4)

bblommers avatar bblommers commented on July 17, 2024

Hi @folkvir! I created a standalone test case in #537 - if I'm understanding the problem correctly, that demonstrates the fact that there is indeed a bug here.

I think the appropriate fix is to extend all FakeDatetime methods to use should_use_real_time, but I don't have a lot of time to look into this - so PR's are welcome.

from freezegun.

folkvir avatar folkvir commented on July 17, 2024

I'll try to look into it and create a pull request as soon as possible but I don't have a lot of time to spend outside my family and job. So if someone has more free time then go!

from freezegun.

folkvir avatar folkvir commented on July 17, 2024

@bblommers Ok after investigations I found calling print(_should_use_real_time()) in the beginning of FakeDatetime.now return "False" because the module name returned by: frame.f_globals.get('__name__') is never listed in ignore_lists[-1]. The ignore_list[-1] is ('tests.another_module', 'nose.plugins', 'six.moves', 'django.utils.six.moves', 'google.gax', 'threading', 'multiprocessing', 'queue', 'selenium', '_pytest.terminal.', '_pytest.runner.', 'gi', 'prompt_toolkit') but the module_name(s) are just:

freezegun.api
tests.test_configure
_pytest.python
pluggy._callers
pluggy._manager

Increasing the call_stack_inspection_limit does not change anything.
So even if we patch FakeDateTime.now with a usage of _should_use_real_time then we won't get the real_time because the function always return false!

from freezegun.

folkvir avatar folkvir commented on July 17, 2024

Update: I think I found the core of the bug; but it may be an artefact of the test setup because we locally import the another_module module. The bug should be reproductible if you comment my changes in freezegun.api.
Changes: master...folkvir:freezegun:bug/ignore-fakedatetime-bug

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.