After executing the pytest I could see its populating the rootdir in results based on the path of "pytest.ini". My issue is I need to use relative path to read some of the files as part of testing, so is there a way to fetch this "rootdir" parameter value during test execution
Use the request fixture. Example:
def test_ini(request):
rootdir = request.config.rootdir
assert (rootdir / 'pytest.ini').isfile()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With