Skip to content

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

@janbernloehr

Description

@janbernloehr

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions