From bed89df69a13ef37caa50da0a68d7fe8371063ed Mon Sep 17 00:00:00 2001 From: Carl Suster Date: Sun, 31 Mar 2019 20:22:44 +1100 Subject: [PATCH] Fix test_ui:test_version under pytest The test `CommonOptionsParserCliTest.test_version` was passing with nose but failing with pytest (see output below). The reason for the failure seemed to be that the `test` plugin was loaded when it wasn't expected to be loaded, changing the output of the `version` command. I'm not sur exactly why that was happening, but since that test already inherited from `TestHelper`, just invoking the plugin load/unload helper was enough to fix it. I also removed the line setting the `self.lib` variable since that's already done in the helper. --- self = def test_version(self): l = self.run_with_output(u'version') self.assertIn(u'Python version', l) > self.assertIn(u'no plugins loaded', l) E AssertionError: 'no plugins loaded' not found in 'beets version 1.4.8\nPython version 3.7.3rc1\nplugins: test\n' test/test_ui.py:1292: AssertionError --- test/test_ui.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_ui.py b/test/test_ui.py index bc9bb4829..8267c9be8 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -1223,13 +1223,14 @@ class CommonOptionsParserCliTest(unittest.TestCase, TestHelper): """ def setUp(self): self.setup_beets() - self.lib = library.Library(':memory:') self.item = _common.item() self.item.path = b'xxx/yyy' self.lib.add(self.item) self.lib.add_album([self.item]) + self.load_plugins() def tearDown(self): + self.unload_plugins() self.teardown_beets() def test_base(self):