fix for tests running subprocesses of py.test after test_argcomplete
(which all still ran with argcompletion enabled) -> fail --HG-- branch : argcomplete
This commit is contained in:
parent
6817a56270
commit
e3a2e1bbf8
|
@ -185,6 +185,10 @@ def test_argcomplete(testdir):
|
|||
# so we use bash
|
||||
fp.write('COMP_WORDBREAKS="$COMP_WORDBREAKS" $(which py.test) '
|
||||
'8>&1 9>&2')
|
||||
# alternative would be exteneded Testdir.{run(),_run(),popen()} to be able
|
||||
# to handle a keyword argument env that replaces os.environ in popen or
|
||||
# extends the copy, advantage: could not forget to restore
|
||||
orgenv = os.environ.copy()
|
||||
os.environ['_ARGCOMPLETE'] = "1"
|
||||
os.environ['_ARGCOMPLETE_IFS'] = "\x0b"
|
||||
os.environ['COMP_WORDBREAKS'] = ' \\t\\n"\\\'><=;|&(:'
|
||||
|
@ -206,3 +210,5 @@ def test_argcomplete(testdir):
|
|||
os.environ['COMP_POINT'] = str(len(os.environ['COMP_LINE']))
|
||||
result = testdir.run('bash', str(script), arg)
|
||||
result.stdout.fnmatch_lines(["test_argcomplete", "test_argcomplete.d/"])
|
||||
# restore environment
|
||||
os.environ = orgenv.copy()
|
||||
|
|
Loading…
Reference in New Issue