1616
1717try :
1818 from cmd2 .argcomplete_bridge import CompletionFinder , tokens_for_completion
19- skip_reason1 = False
19+ skip_no_argcomplete = False
2020 skip_reason = ''
2121except ImportError :
2222 # Don't test if argcomplete isn't present (likely on Windows)
23- skip_reason1 = True
23+ skip_no_argcomplete = True
2424 skip_reason = "argcomplete isn't installed\n "
2525
26- skip_reason2 = "TRAVIS" in os .environ and os .environ ["TRAVIS" ] == "true"
27- if skip_reason2 :
26+ skip_travis = "TRAVIS" in os .environ and os .environ ["TRAVIS" ] == "true"
27+ if skip_travis :
2828 skip_reason += 'These tests cannot run on TRAVIS\n '
2929
30- skip_reason3 = sys .platform .startswith ('win' )
31- if skip_reason3 :
30+ skip_windows = sys .platform .startswith ('win' )
31+ if skip_windows :
3232 skip_reason = 'argcomplete doesn\' t support Windows'
3333
34- skip = skip_reason1 or skip_reason2 or skip_reason3
34+ skip = skip_no_argcomplete or skip_travis or skip_windows
3535
3636skip_mac = sys .platform .startswith ('dar' )
3737
@@ -103,7 +103,7 @@ def _do_media_shows(self, args) -> None:
103103
104104
105105# noinspection PyShadowingNames
106- @pytest .mark .skipif (skip , reason = skip_reason )
106+ @pytest .mark .skipif (skip_no_argcomplete or skip_windows , reason = skip_reason )
107107def test_bash_nocomplete (parser1 ):
108108 completer = CompletionFinder ()
109109 result = completer (parser1 , AutoCompleter (parser1 ))
@@ -122,7 +122,7 @@ def my_fdopen(fd, mode, *args):
122122
123123
124124# noinspection PyShadowingNames
125- @pytest .mark .skipif (skip , reason = skip_reason )
125+ @pytest .mark .skipif (skip_no_argcomplete or skip_windows , reason = skip_reason )
126126def test_invalid_ifs (parser1 , mock ):
127127 completer = CompletionFinder ()
128128
@@ -176,7 +176,7 @@ def fdopen_fail_8(fd, mode, *args):
176176
177177
178178# noinspection PyShadowingNames
179- @pytest .mark .skipif (skip , reason = skip_reason )
179+ @pytest .mark .skipif (skip_no_argcomplete or skip_windows , reason = skip_reason )
180180def test_fail_alt_stdout (parser1 , mock ):
181181 completer = CompletionFinder ()
182182
@@ -232,7 +232,7 @@ def test_fail_alt_stderr(parser1, capfd, mock):
232232 assert out == exp_out
233233 assert err == exp_err
234234
235- @pytest .mark .skipif (skip_reason1 , reason = skip_reason )
235+ @pytest .mark .skipif (skip_no_argcomplete , reason = skip_reason )
236236def test_argcomplete_tokens_for_completion_simple ():
237237 line = 'this is "a test"'
238238 endidx = len (line )
@@ -243,7 +243,7 @@ def test_argcomplete_tokens_for_completion_simple():
243243 assert begin_idx == line .rfind ("is " ) + len ("is " )
244244 assert end_idx == end_idx
245245
246- @pytest .mark .skipif (skip_reason1 , reason = skip_reason )
246+ @pytest .mark .skipif (skip_no_argcomplete , reason = skip_reason )
247247def test_argcomplete_tokens_for_completion_unclosed_quotee_exception ():
248248 line = 'this is "a test'
249249 endidx = len (line )
0 commit comments