Calling pytest.main() does not pick up changes made to test script file
Hello, We are developing an in-house testing tool based on pytest and are interested in calling pytest programmatically using pytest.main(). Unfortunately, using this approach, pytest does not "see" changes I make to my pytest test script file between successive calls to pytest.main(). For example, I have a pytest test script called "testscript.py". This test script file currently has one test called "test_1". If I call pytest.main("testscript.py") it correctly runs the one "test_1" test. If I now change the testscript.py file to include, for instance, the definition of another test (called "test_2") and run pytest.main("testscript.py") it does not see test_2 but only shows test_1. In order for pytest to see test_2, I must shut down the Python terminal, open a new Python terminal and then call pytest.main() again. This workflow is unfortunately not acceptable for our use case. Does pytest have some file caching mechanism that is causing this issue? Is there a pytest configuration option I am missing that can fix this? Am I doing anything wrong? Any help in this regard is greatly appreciated. Thank you, Alfonso
participants (1)
-
achartier@fastmail.fm