Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Incorrect number of collected items reported when specific class methods are provided #2464
It seems that the number of collected tests is displayed incorrectly when the "class method" notation (
That's perfectly reasonable to assume, it it is just not how things work currently.
To discover test items from a module, pytest has to import that module. At that point it creates the test items it finds in that namespace, and only then it picks out the test id provided in the command line to execute. It does so because it has to create a test item in order to know its node id (to account for parametrization, hooks, etc, anything which in the end affects the node id), so it might as well create all test items for a module upon discovery.