@@ -81,8 +81,6 @@ def bash_repl(command="bash"):
81
81
def zsh_repl (command = "zsh" ):
82
82
sh = _repl_sh (command , ["--no-rcs" , "-V" ], non_printable_insert = "%(!..)" )
83
83
sh .run_command ("autoload compinit; compinit -u" )
84
- # Require two tabs to print all options (some tests rely on this).
85
- sh .run_command ("setopt BASH_AUTO_LIST" )
86
84
return sh
87
85
88
86
@@ -1262,6 +1260,9 @@ def setUp(self):
1262
1260
path = ":" .join ([os .path .join (BASE_DIR , "scripts" ), TEST_DIR , "$PATH" ])
1263
1261
sh .run_command ("export PATH={0}" .format (path ))
1264
1262
sh .run_command ("export PYTHONPATH={0}" .format (BASE_DIR ))
1263
+ if self .repl_provider == bash_repl :
1264
+ # Disable the "python" module provided by bash-completion
1265
+ sh .run_command ("complete -r python python2 python3" )
1265
1266
output = sh .run_command (self .install_cmd )
1266
1267
self .assertEqual (output , "" )
1267
1268
# Register a dummy completion with an external argcomplete script
@@ -1316,24 +1317,18 @@ class TestZsh(TestBashZshBase, unittest.TestCase):
1316
1317
"test_parse_special_characters_dollar" ,
1317
1318
"test_comp_point" , # FIXME
1318
1319
"test_completion_environment" , # FIXME
1320
+ "test_continuation" , # FIXME
1321
+ "test_wordbreak_chars" , # FIXME
1319
1322
]
1320
1323
1321
1324
def repl_provider (self ):
1322
1325
return zsh_repl ()
1323
1326
1324
1327
1325
- class TestBashZshGlobalBase (TestBashZshBase ):
1328
+ @unittest .skipIf (BASH_MAJOR_VERSION < 4 , "complete -D not supported" )
1329
+ class TestBashGlobal (TestBash ):
1326
1330
install_cmd = 'eval "$(activate-global-python-argcomplete --dest=-)"'
1327
1331
1328
- def test_redirection_completion (self ):
1329
- with TempDir (prefix = "test_dir_py" , dir = "." ):
1330
- self .sh .run_command ("cd " + os .getcwd ())
1331
- self .sh .run_command ("echo failure > ./foo.txt" )
1332
- self .sh .run_command ("echo success > ./foo.\t " )
1333
- with open ("foo.txt" ) as f :
1334
- msg = f .read ()
1335
- self .assertEqual (msg , "success\n " )
1336
-
1337
1332
def test_python_completion (self ):
1338
1333
self .sh .run_command ("cd " + TEST_DIR )
1339
1334
self .assertEqual (self .sh .run_command ("python3 ./prog basic f\t " ), "foo\r \n " )
@@ -1373,6 +1368,9 @@ def _test_console_script(self, package=False, wheel=False):
1373
1368
command = "pip install {} --target ." .format (test_package )
1374
1369
if not wheel :
1375
1370
command += " --no-binary :all:"
1371
+ if sys .platform == "darwin" :
1372
+ # Work around https://stackoverflow.com/questions/24257803
1373
+ command += ' --install-option="--prefix="'
1376
1374
install_output = self .sh .run_command (command )
1377
1375
self .assertEqual (self .sh .run_command ("echo $?" ), "0\r \n " , install_output )
1378
1376
command = "test-module"
@@ -1381,32 +1379,27 @@ def _test_console_script(self, package=False, wheel=False):
1381
1379
command += " a\t "
1382
1380
self .assertEqual (self .sh .run_command (command ), "arg\r \n " )
1383
1381
1382
+ @unittest .skipIf (os .uname ()[0 ] == "Darwin" , "Skip test that fails on MacOS" )
1384
1383
def test_console_script_module (self ):
1385
1384
"""Test completing a console_script for a module."""
1386
1385
self ._test_console_script ()
1387
1386
1387
+ @unittest .skipIf (os .uname ()[0 ] == "Darwin" , "Skip test that fails on MacOS" )
1388
1388
def test_console_script_package (self ):
1389
1389
"""Test completing a console_script for a package."""
1390
1390
self ._test_console_script (package = True )
1391
1391
1392
+ @unittest .skipIf (os .uname ()[0 ] == "Darwin" , "Skip test that fails on MacOS" )
1392
1393
def test_console_script_module_wheel (self ):
1393
1394
"""Test completing a console_script for a module from a wheel."""
1394
1395
self ._test_console_script (wheel = True )
1395
1396
1397
+ @unittest .skipIf (os .uname ()[0 ] == "Darwin" , "Skip test that fails on MacOS" )
1396
1398
def test_console_script_package_wheel (self ):
1397
1399
"""Test completing a console_script for a package from a wheel."""
1398
1400
self ._test_console_script (package = True , wheel = True )
1399
1401
1400
1402
1401
- @unittest .skipIf (BASH_MAJOR_VERSION < 4 , "complete -D not supported" )
1402
- class TestBashGlobal (TestBash , TestBashZshGlobalBase ):
1403
- pass
1404
-
1405
-
1406
- class TestZshGlobal (TestZsh , TestBashZshGlobalBase ):
1407
- pass
1408
-
1409
-
1410
1403
class Shell :
1411
1404
def __init__ (self , shell ):
1412
1405
self .child = pexpect .spawn (shell , encoding = "utf-8" )
0 commit comments