diff --git a/beets/test/_common.py b/beets/test/_common.py index 7c7defb02..0d2d51f1e 100644 --- a/beets/test/_common.py +++ b/beets/test/_common.py @@ -115,11 +115,6 @@ def import_session(lib=None, loghandler=None, paths=[], query=[], cli=False): class Assertions: """A mixin with additional unit test assertions.""" - def assertIsFile(self, path): - path = Path(os.fsdecode(path)) - assert path.exists() - assert path.is_file() - def assertIsDir(self, path): path = Path(os.fsdecode(path)) assert path.exists() diff --git a/test/plugins/test_convert.py b/test/plugins/test_convert.py index e889ce7bb..25a000284 100644 --- a/test/plugins/test_convert.py +++ b/test/plugins/test_convert.py @@ -58,13 +58,18 @@ class ConvertMixin: shell_quote(sys.executable), shell_quote(stub), tag ) + def assert_is_file(self, path): + path = Path(os.fsdecode(path)) + assert path.exists() + assert path.is_file() + def assertFileTag(self, path, tag): """Assert that the path is a file and the files content ends with `tag`. """ display_tag = tag tag = tag.encode("utf-8") - self.assertIsFile(path) + self.assert_is_file(path) with open(path, "rb") as f: f.seek(-len(display_tag), os.SEEK_END) assert f.read() == tag, ( @@ -77,7 +82,7 @@ class ConvertMixin: """ display_tag = tag tag = tag.encode("utf-8") - self.assertIsFile(path) + self.assert_is_file(path) with open(path, "rb") as f: f.seek(-len(tag), os.SEEK_END) assert f.read() != tag, ( @@ -117,7 +122,7 @@ class ImportConvertTest(AsIsImporterMixin, ImportHelper, ConvertTestCase): item = self.lib.items().get() assert item is not None - self.assertIsFile(item.path) + self.assert_is_file(item.path) def test_delete_originals(self): self.config["convert"]["delete_originals"] = True