From 5a3157d85d76f8e3955e2add763ffb54667d49c5 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 2 Jun 2019 20:12:07 -0400 Subject: [PATCH] Try to make a test more reliable As @arcresu pointed out on Gitter, this openSUSE patch adds a safeguard to this test, which was apparently failing for them: https://build.opensuse.org/package/view_file/openSUSE:Factory/beets/fix_test_command_line_option_relative_to_working_dir.diff?expand=1 Reading the configuration once here to make sure that we're in a clean state seems harmless enough. The culprit is likely that a previous test was modifying the configuration and not properly cleaning up. This change defends against that kind of mistake. --- docs/changelog.rst | 3 +++ test/test_ui.py | 1 + 2 files changed, 4 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 7a74f556b8..7bfe10177f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -46,6 +46,9 @@ For packagers: called `Confuse`_, released as :pypi:`confuse`. Beets now depends on this package. Confuse has existed separately for some time and is used by unrelated projects, but until now we've been bundling a copy within beets. +* We attempted to fix an unreliable test, so a patch to `skip `_ + or `repair `_ + the test may no longer be necessary. .. _MediaFile: https://github.com/beetbox/mediafile .. _Confuse: https://github.com/beetbox/confuse diff --git a/test/test_ui.py b/test/test_ui.py index da3160db7f..110e807828 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -918,6 +918,7 @@ def test_cli_config_paths_resolve_relative_to_beetsdir(self): ) def test_command_line_option_relative_to_working_dir(self): + config.read() os.chdir(self.temp_dir) self.run_command('--library', 'foo.db', 'test', lib=None) self.assert_equal_path(config['library'].as_filename(),