I am trying to sort out how to get a list of just the test names from a test file using pytest I have made it this far:
$ pytest --collect-only my_test_file.py
============================================================================================= test session starts ==============================================================================================
platform darwin -- Python 3.6.4, pytest-3.2.5, py-1.5.2, pluggy-0.4.0
rootdir: /Users/.../automation, inifile:
plugins: xdist-1.20.1, metadata-1.7.0, html-1.17.0, forked-0.2, cloud-2.0.0
collected 6 items
<Module 'my_test_file.py'>
<UnitTestCase 'TestFile'>
<TestCaseFunction 'test_general'>
<TestCaseFunction 'test_search_0'>
<TestCaseFunction 'test_search_1'>
<TestCaseFunction 'test_search_2'>
<TestCaseFunction 'test_search_3'>
<TestCaseFunction 'test_search_4'>
While this is a good start it is too much information. What should I be passing to just get back a list of the test names themselves?
-s
should make output more concise, I think... but you are not executing... perhaps no effect – Impalpable-s
is used to avoid capturing the output, so for example, print statements will be shown in the console. Thus, this is not a solution. – Archiphoneme