Skip to content

Commit

Permalink
[cli] [test] Add some useful pytest arguments (#1465)
Browse files Browse the repository at this point in the history
* [cli] [test] Add some useful pytest arguments

* Apply suggestions from code review

Co-authored-by: xumingkuan <xumingkuan0721@126.com>

Co-authored-by: xumingkuan <xumingkuan0721@126.com>
  • Loading branch information
archibate and xumingkuan authored Jul 12, 2020
1 parent 315c3fc commit 96ab837
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions python/taichi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,14 @@ def _test_python(args):
pytest_args += ['-s', '-v']
if args.rerun:
pytest_args += ['--reruns', args.rerun]
if args.keys:
pytest_args += ['-k', args.keys]
if args.marks:
pytest_args += ['-m', args.marks]
if args.failed_first:
pytest_args += ['--failed-first']
if args.fail_fast:
pytest_args += ['--exitfirst']
try:
if args.coverage:
pytest_args += ['--cov-branch', '--cov=python/taichi']
Expand Down Expand Up @@ -815,6 +823,34 @@ def test(self, arguments: list = sys.argv[2:]):
dest='rerun',
type=str,
help='Rerun failed tests for given times')
parser.add_argument('-k',
'--keys',
required=False,
default=None,
dest='keys',
type=str,
help='Only run tests that match the keys')
parser.add_argument('-m',
'--marks',
required=False,
default=None,
dest='marks',
type=str,
help='Only run tests with specific marks')
parser.add_argument('-f',
'--failed-first',
required=False,
default=None,
dest='failed_first',
action='store_true',
help='Run the previously failed test first')
parser.add_argument('-x',
'--fail-fast',
required=False,
default=None,
dest='fail_fast',
action='store_true',
help='Exit instantly on the first failed test')
parser.add_argument('-C',
'--coverage',
required=False,
Expand Down

0 comments on commit 96ab837

Please sign in to comment.