Skip to content

Commit

Permalink
Experimental auto fallback from pytest to unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
boxed committed Jul 28, 2020
1 parent acbb77b commit 9fc5686
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mutmut/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def do_apply(mutation_pk, dict_synonyms, backup):

null_out = open(os.devnull, 'w')

DEFAULT_RUNNER = 'python -m pytest -x --assert=plain'

@click.command(context_settings=dict(help_option_names=['-h', '--help']))
@click.argument('command', nargs=1, required=False)
Expand All @@ -102,7 +103,7 @@ def do_apply(mutation_pk, dict_synonyms, backup):
@config_from_setup_cfg(
dict_synonyms='',
paths_to_exclude='',
runner='python -m pytest -x --assert=plain',
runner=DEFAULT_RUNNER,
tests_dir='tests/:test/',
pre_mutation=None,
post_mutation=None,
Expand Down Expand Up @@ -242,6 +243,12 @@ def main(command, argument, argument2, paths_to_mutate, backup, runner, tests_di
🙁 Survived. This means your tests needs to be expanded.
🔇 Skipped. Skipped.
""")
if runner is DEFAULT_RUNNER:
try:
import pytest
except ImportError:
runner = 'python -m unittest'

baseline_time_elapsed = time_test_suite(
swallow_output=not swallow_output,
test_command=runner,
Expand Down

0 comments on commit 9fc5686

Please sign in to comment.