In completion tests, don't load system scripts

On my machine, the "leak" of other bash_completion scripts here recently
started doing a *lot* of work for other packages. Most damningly, it started
compiling a bunch of stuff with rustc! Now we only load beets' own completion
stuff.
This commit is contained in:
Adrian Sampson 2016-07-25 12:57:44 -04:00
parent e65e7a6716
commit b73bbf0b3e

View file

@ -1123,12 +1123,18 @@ class CompletionTest(_common.TestCase, TestHelper):
config['pluginpath'] = [_common.PLUGINPATH]
config['plugins'] = ['test']
# Tests run in bash
# Do not load any other bash completion scripts on the system.
env = dict(os.environ)
env['BASH_COMPLETION_DIR'] = os.devnull
env['BASH_COMPLETION_COMPAT_DIR'] = os.devnull
# Open a `bash` process to run the tests in. We'll pipe in bash
# commands via stdin.
cmd = os.environ.get('BEETS_TEST_SHELL', '/bin/bash --norc').split()
if not has_program(cmd[0]):
self.skipTest(u'bash not available')
tester = subprocess.Popen(cmd, stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
stdout=subprocess.PIPE, env=env)
# Load bash_completion library.
for path in commands.BASH_COMPLETION_PATHS: