Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to global / class variables are ignored (if no method of their module is executed) #191

Open
janbernloehr opened this issue Aug 17, 2022 · 3 comments

Comments

@janbernloehr
Copy link
Contributor

janbernloehr commented Aug 17, 2022

Suppose you have the following files

# mymodule.py
foo_bar = "value"

class MyClass:
    FOO = "bar"

# test_mymodule.py
from mymodule import MyClass, foo_bar

def test_module():
    assert foo_bar == "value"
    assert MyClass.FOO == "bar"

Now running pytest --testmon test_mymodule.py does not rerun test_module() when the value of MyClass.FOO or foo_bar is changed. Even worse, FOO can be completely removed, e.g.

class MyClass:
    pass

without triggering a re-run.

When running pytest --cov manually, there seems to be a trace

image

@janbernloehr janbernloehr changed the title Changes to class variables are ignored Changes to global / class variables are ignored Aug 17, 2022
@tarpas
Copy link
Owner

tarpas commented Aug 17, 2022

Unfortunately this is quite a fundamental limitation. It's not impossible to fix but hard.

@tarpas
Copy link
Owner

tarpas commented Oct 26, 2022

It's also worth mentioning that if there is at least one function or method from mymodule used in test_mymodule then any change in mymodule is taken into account.

@tarpas tarpas changed the title Changes to global / class variables are ignored Changes to global / class variables are ignored (if no method of their module is executed) Oct 26, 2022
@janbernloehr
Copy link
Contributor Author

This issue is unfortunately still present with testmon 2.0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants