github.phpd.cn/thought-machine/please@v12.2.0+incompatible/tools/please_pex/pytest.py (about)

     1  import os
     2  
     3  
     4  def run_tests(test_names):
     5      """Runs tests using pytest, returns the number of failures."""
     6      # N.B. import must be deferred until we have set up import paths.
     7      from pytest import main
     8      args = ['--junitxml', 'test.results'] + TEST_NAMES
     9      if test_names:
    10          args += ['-k', ' '.join(test_names)]
    11      if os.environ.get('DEBUG'):
    12          args.append('--pdb')
    13      return main(args)