mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Replace assertIsDir
This commit is contained in:
parent
ca4fa6ba10
commit
43b8cce063
3 changed files with 7 additions and 16 deletions
|
|
@ -18,7 +18,6 @@ import os
|
|||
import sys
|
||||
import unittest
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
|
||||
import beets
|
||||
import beets.library
|
||||
|
|
@ -115,11 +114,6 @@ def import_session(lib=None, loghandler=None, paths=[], query=[], cli=False):
|
|||
class Assertions:
|
||||
"""A mixin with additional unit test assertions."""
|
||||
|
||||
def assertIsDir(self, path):
|
||||
path = Path(os.fsdecode(path))
|
||||
assert path.exists()
|
||||
assert path.is_dir()
|
||||
|
||||
def assert_equal_path(self, a, b):
|
||||
"""Check that two paths are equal."""
|
||||
a_bytes, b_bytes = util.normpath(a), util.normpath(b)
|
||||
|
|
|
|||
|
|
@ -671,12 +671,9 @@ class UniquePathTest(BeetsTestCase):
|
|||
|
||||
|
||||
class MkDirAllTest(BeetsTestCase):
|
||||
def test_parent_exists(self):
|
||||
path = self.temp_dir_path / "foo" / "bar" / "baz" / "qux.mp3"
|
||||
util.mkdirall(path)
|
||||
self.assertIsDir(self.temp_dir_path / "foo" / "bar" / "baz")
|
||||
|
||||
def test_child_does_not_exist(self):
|
||||
path = self.temp_dir_path / "foo" / "bar" / "baz" / "qux.mp3"
|
||||
util.mkdirall(path)
|
||||
assert not path.exists()
|
||||
def test_mkdirall(self):
|
||||
child = self.temp_dir_path / "foo" / "bar" / "baz" / "quz.mp3"
|
||||
util.mkdirall(child)
|
||||
assert not child.exists()
|
||||
assert child.parent.exists()
|
||||
assert child.parent.is_dir()
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ class ImportTest(PathsMixin, AutotagImportTestCase):
|
|||
assert not self.lib.items()
|
||||
|
||||
def test_skip_non_album_dirs(self):
|
||||
self.assertIsDir(os.path.join(self.import_dir, b"album"))
|
||||
assert (self.import_path / "album").exists()
|
||||
self.touch(b"cruft", dir=self.import_dir)
|
||||
self.importer.add_choice(importer.Action.APPLY)
|
||||
self.importer.run()
|
||||
|
|
|
|||
Loading…
Reference in a new issue