I'm creating a python test suite (using py.test). I'm coding the tests in Idea and I don't know how to debug a single test.
This is my setting of the debugger. It runs the whole testsuite. So I have to run all the tests before it gets to the one I'm trying to debug.
In your configuration, set:
testsuite/psa/test_psa_integration.py
TestPsaIntegration and test_psa_integration_example
I don't use IntelliJ, but in PyCharm, you can easily debug tests without going through this tedious process of adding a Run/Debug configuration each time.
To do this with PyCharm, go to: Preferences (or Settings) > Tools > Python Integrated Tools
and set Default test runner
to py.test
.
Then, back in your file (ie test_psa_integration.py
), you could just right-click anywhere within the code of a test, and select either Run 'py.test in ...'
or Debug 'py.test in...'
which will automatically create a new Run/Debug configuration as explained previously.
An alternative is adding --no-cov --capture=no
into Additional Arguments . To make this automatic for other test file, add those into the Template part.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.