py.test - How do I get a pythonic list of all the pytest tests in a folder? -


something --collect, python , not cmd, returns list of paths. tried see how pytest , can't seem ro find it.

thanks!

all collected tests stored attribute items of session. can access session object by

  1. session level fixture
  2. pytest plugins, example: pytest_runtestloop or pytest_sessionstart

example:

@pytest.fixture(scope='session', autouse=true) def get_all_tests(request):     items = request.session.items     all_tests_names = [item.name item in items]     all_tests_locations = [item.location item in items]     # location tuple of (file_path, linenumber, classname.methodname) 

if want more info object session or item, of cause can read docs or source code, prefer use pdb.set_trace dig object.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -