diff options
-rw-r--r-- | tests/test_bashcompletion.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/test_bashcompletion.py b/tests/test_bashcompletion.py index e2c28fce..47fcdb34 100644 --- a/tests/test_bashcompletion.py +++ b/tests/test_bashcompletion.py @@ -16,22 +16,22 @@ from cmd2.argparse_completer import ACArgumentParser, AutoCompleter try: from cmd2.argcomplete_bridge import CompletionFinder, tokens_for_completion - skip_reason1 = False + skip_no_argcomplete = False skip_reason = '' except ImportError: # Don't test if argcomplete isn't present (likely on Windows) - skip_reason1 = True + skip_no_argcomplete = True skip_reason = "argcomplete isn't installed\n" -skip_reason2 = "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true" -if skip_reason2: +skip_travis = "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true" +if skip_travis: skip_reason += 'These tests cannot run on TRAVIS\n' -skip_reason3 = sys.platform.startswith('win') -if skip_reason3: +skip_windows = sys.platform.startswith('win') +if skip_windows: skip_reason = 'argcomplete doesn\'t support Windows' -skip = skip_reason1 or skip_reason2 or skip_reason3 +skip = skip_no_argcomplete or skip_travis or skip_windows skip_mac = sys.platform.startswith('dar') @@ -103,7 +103,7 @@ def parser1(): # noinspection PyShadowingNames -@pytest.mark.skipif(skip, reason=skip_reason) +@pytest.mark.skipif(skip_no_argcomplete or skip_windows, reason=skip_reason) def test_bash_nocomplete(parser1): completer = CompletionFinder() result = completer(parser1, AutoCompleter(parser1)) @@ -122,7 +122,7 @@ def my_fdopen(fd, mode, *args): # noinspection PyShadowingNames -@pytest.mark.skipif(skip, reason=skip_reason) +@pytest.mark.skipif(skip_no_argcomplete or skip_windows, reason=skip_reason) def test_invalid_ifs(parser1, mock): completer = CompletionFinder() @@ -176,7 +176,7 @@ def fdopen_fail_8(fd, mode, *args): # noinspection PyShadowingNames -@pytest.mark.skipif(skip, reason=skip_reason) +@pytest.mark.skipif(skip_no_argcomplete or skip_windows, reason=skip_reason) def test_fail_alt_stdout(parser1, mock): completer = CompletionFinder() @@ -232,7 +232,7 @@ Hint: assert out == exp_out assert err == exp_err -@pytest.mark.skipif(skip_reason1, reason=skip_reason) +@pytest.mark.skipif(skip_no_argcomplete, reason=skip_reason) def test_argcomplete_tokens_for_completion_simple(): line = 'this is "a test"' endidx = len(line) @@ -243,7 +243,7 @@ def test_argcomplete_tokens_for_completion_simple(): assert begin_idx == line.rfind("is ") + len("is ") assert end_idx == end_idx -@pytest.mark.skipif(skip_reason1, reason=skip_reason) +@pytest.mark.skipif(skip_no_argcomplete, reason=skip_reason) def test_argcomplete_tokens_for_completion_unclosed_quotee_exception(): line = 'this is "a test' endidx = len(line) |