-
- Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
topic: collectionrelated to the collection phaserelated to the collection phasetype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature
Description
-
a detailed description of the bug or problem you are having
when importing a function where its name starts withtest_
from a module that would normally be ignored by pytest, it gets incorrectly recognized as a test. -
output of
pip list
from the virtual environment you are usingPackage Version ---------- ------- pip 22.3.1 setuptools 65.5.0
-
pytest and operating system versions
pytest 7.4.2, windows 10 -
minimal example if possible
# some_module/utils.py def test_not_a_test(): """this function is incorrectly detected as a test when imported from test_foo.py""" # test_foo.py from some_module.utils import test_not_a_test def test_foo(): test_not_a_test()
when collecting, pytest should check the module of each function to make sure it's defined in the same file to prevent it from incorrectly matching imported functions from different modules
KotlinIsland and scott-au
Metadata
Metadata
Assignees
Labels
topic: collectionrelated to the collection phaserelated to the collection phasetype: proposalproposal for a new feature, often to gather opinions or design the API around the new featureproposal for a new feature, often to gather opinions or design the API around the new feature