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.
This commit is contained in:
Adrian Sampson 2019-06-02 20:12:07 -04:00
parent 94b38ee78c
commit 5a3157d85d
2 changed files with 4 additions and 0 deletions

View file

@ -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 <https://sources.debian.org/src/beets/1.4.7-2/debian/patches/skip-broken-test/>`_
or `repair <https://build.opensuse.org/package/view_file/openSUSE:Factory/beets/fix_test_command_line_option_relative_to_working_dir.diff?expand=1>`_
the test may no longer be necessary.
.. _MediaFile: https://github.com/beetbox/mediafile
.. _Confuse: https://github.com/beetbox/confuse

View file

@ -918,6 +918,7 @@ class ConfigTest(unittest.TestCase, TestHelper, _common.Assertions):
)
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(),