Describe the bug
Pytest is flexible enough to run inside of subdirectories and automatically launch files with the name test_*.py and *_test.py in the current directory and any subdirectories. If I try to do a pytest in fre/make tests fail due to the use of getcwd. The tests run fine when cwd is the location of fre-cli.
|
currPath=os.getcwd() |
|
SERIAL_TEST_PATH=f"{currPath}/fre/make/tests/compilation/serial_build" |
|
MULTIJOB_TEST_PATH=f"{currPath}/fre/make/tests/compilation/multijob_build" |
|
CONTAINER_BUILD_TEST_PATH=f"{currPath}/fre/make/tests/compilation/container" |
|
Path(SERIAL_TEST_PATH).mkdir(parents=True,exist_ok=True) |
|
Path(MULTIJOB_TEST_PATH).mkdir(parents=True,exist_ok=True) |
|
Path(CONTAINER_BUILD_TEST_PATH).mkdir(parents=True,exist_ok=True) |
To Reproduce
cd fre/make
pytest
a bunch of tests fail due to not finding the yaml file
Expected behavior
the filepath's should be relative to the python script and not the current working directory:
currPath=os.path.dirname(__file__)
SERIAL_TEST_PATH=f"{currPath}/serial_build"
MULTIJOB_TEST_PATH=f"{currPath}/multijob_build"
CONTAINER_BUILD_TEST_PATH=f"{currPath}/container"
and any relative file paths should be defined relative to the location of the test file.
Describe the bug
Pytest is flexible enough to run inside of subdirectories and automatically launch files with the name test_*.py and *_test.py in the current directory and any subdirectories. If I try to do a pytest in fre/make tests fail due to the use of getcwd. The tests run fine when cwd is the location of fre-cli.
fre-cli/fre/make/tests/compilation/test_run_fremake_builds.py
Lines 31 to 37 in b34af59
To Reproduce
cd fre/make
pytest
a bunch of tests fail due to not finding the yaml file
Expected behavior
the filepath's should be relative to the python script and not the current working directory:
and any relative file paths should be defined relative to the location of the test file.