16
16
17
17
try :
18
18
from cmd2 .argcomplete_bridge import CompletionFinder , tokens_for_completion
19
- skip_reason1 = False
19
+ skip_no_argcomplete = False
20
20
skip_reason = ''
21
21
except ImportError :
22
22
# Don't test if argcomplete isn't present (likely on Windows)
23
- skip_reason1 = True
23
+ skip_no_argcomplete = True
24
24
skip_reason = "argcomplete isn't installed\n "
25
25
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 :
28
28
skip_reason += 'These tests cannot run on TRAVIS\n '
29
29
30
- skip_reason3 = sys .platform .startswith ('win' )
31
- if skip_reason3 :
30
+ skip_windows = sys .platform .startswith ('win' )
31
+ if skip_windows :
32
32
skip_reason = 'argcomplete doesn\' t support Windows'
33
33
34
- skip = skip_reason1 or skip_reason2 or skip_reason3
34
+ skip = skip_no_argcomplete or skip_travis or skip_windows
35
35
36
36
skip_mac = sys .platform .startswith ('dar' )
37
37
@@ -103,7 +103,7 @@ def _do_media_shows(self, args) -> None:
103
103
104
104
105
105
# noinspection PyShadowingNames
106
- @pytest .mark .skipif (skip , reason = skip_reason )
106
+ @pytest .mark .skipif (skip_no_argcomplete or skip_windows , reason = skip_reason )
107
107
def test_bash_nocomplete (parser1 ):
108
108
completer = CompletionFinder ()
109
109
result = completer (parser1 , AutoCompleter (parser1 ))
@@ -122,7 +122,7 @@ def my_fdopen(fd, mode, *args):
122
122
123
123
124
124
# noinspection PyShadowingNames
125
- @pytest .mark .skipif (skip , reason = skip_reason )
125
+ @pytest .mark .skipif (skip_no_argcomplete or skip_windows , reason = skip_reason )
126
126
def test_invalid_ifs (parser1 , mock ):
127
127
completer = CompletionFinder ()
128
128
@@ -176,7 +176,7 @@ def fdopen_fail_8(fd, mode, *args):
176
176
177
177
178
178
# noinspection PyShadowingNames
179
- @pytest .mark .skipif (skip , reason = skip_reason )
179
+ @pytest .mark .skipif (skip_no_argcomplete or skip_windows , reason = skip_reason )
180
180
def test_fail_alt_stdout (parser1 , mock ):
181
181
completer = CompletionFinder ()
182
182
@@ -232,7 +232,7 @@ def test_fail_alt_stderr(parser1, capfd, mock):
232
232
assert out == exp_out
233
233
assert err == exp_err
234
234
235
- @pytest .mark .skipif (skip_reason1 , reason = skip_reason )
235
+ @pytest .mark .skipif (skip_no_argcomplete , reason = skip_reason )
236
236
def test_argcomplete_tokens_for_completion_simple ():
237
237
line = 'this is "a test"'
238
238
endidx = len (line )
@@ -243,7 +243,7 @@ def test_argcomplete_tokens_for_completion_simple():
243
243
assert begin_idx == line .rfind ("is " ) + len ("is " )
244
244
assert end_idx == end_idx
245
245
246
- @pytest .mark .skipif (skip_reason1 , reason = skip_reason )
246
+ @pytest .mark .skipif (skip_no_argcomplete , reason = skip_reason )
247
247
def test_argcomplete_tokens_for_completion_unclosed_quotee_exception ():
248
248
line = 'this is "a test'
249
249
endidx = len (line )
0 commit comments