In tests directory has 2 sub-directories such as tests/api and tests/sanity. Note tests/api has conftest.py that expects to find input.conf in tests/api directory. Note running tests from tests/api works fine. But run test from parent directory tests, it failed with:
py.test –test_option=input.conf
Usage: py.test [options] [file_or_dir] [file_or_dir] […]
py.test: error: no such option: –test_option
Can someone please shows how I can structure my test so this would work?
I also tried specify the test directory such as the following but it cannot find input.conf.
py.test –test_option=input.conf api/test_api.py
E IOError: [Errno 2] No such file or directory: ‘input.conf’
Assuming that your syntax is correct (you are I think transposing the name and extension of the file) you just need to specify the location of the file correctly including relative or absolute path:
Instead of:
do: