Skip to content

specifying '-c path/pytest.ini' in pytest.main() only uses function pattern(python_functions) for one file #10856

Answered by jgzzzz
jgzzzz asked this question in Q&A
Discussion options

You must be logged in to vote

The solution was to pass --rootdir=path\tests in the arguments to the pytest.main() since the modules/nodes are named based on the relative path from rootdir and the path to the python file where the tests are, in this case tests\testfile1 or testfile2.

What I was doing before was that the rootdir was completely different to the path to the testfile1.py or testfile2.py, so the relative path did not work(constuctor FSCollector of node.py in pytest code), so only the first one was loaded unnamed(collect() function in main.py), and since the second module was also not named it was considered to be the same as the first, and the tests in testfile2.py where not loaded.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jgzzzz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant