Home Ask Login Register

Developers Planet

Your answer is one click away!

Timur February 2016

py.test: how to forbid to load conftest files in upper directories

I have structure like this:

conftest.py
dir/conftest.py
dir/test_my.py

When I change directory to dir and run py.test test_my.py, my tests start with configuration, declared in the outer conftest.py (which is out of dir). Is there any way to change pytest behaviour: to load conftest-file only from the local directory?

Answers


The Compiler February 2016

You can set the confcutdir option to specify where pytest should stop searching for conftest.py files.

Post Status

Asked in February 2016
Viewed 2,839 times
Voted 8
Answered 1 times

Search




Leave an answer


Quote of the day: live life