From b73bbf0b3ec4b64054c4f14a995eef4a770727e2 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Mon, 25 Jul 2016 12:57:44 -0400 Subject: [PATCH] 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. --- test/test_ui.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/test_ui.py b/test/test_ui.py index 61e3ff33e..ab8cc289d 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -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: