mirror of
https://github.com/beetbox/beets.git
synced 2026-01-09 17:33:51 +01:00
added test cases and change log
This commit is contained in:
parent
5540c4a6e3
commit
933132f71e
1 changed files with 0 additions and 39 deletions
|
|
@ -260,45 +260,6 @@ class ConvertCliTest(ConvertTestCase, ConvertCommand):
|
|||
self.run_convert("--playlist", "playlist.m3u8", "--pretend")
|
||||
assert not (self.convert_dest / "playlist.m3u8").exists()
|
||||
|
||||
def test_playlist_generation_with_fallback(self):
|
||||
# Access fixtures or setup in this method or a setup method
|
||||
tmp_path = self.tmp_path # Assume tmp_path is set up in self or via setup
|
||||
library = self.library # Likewise for library
|
||||
convert_plugin = self.convert_plugin
|
||||
|
||||
# Setup items
|
||||
item_with_path = library.add_item(path=str(tmp_path / "song1.mp3"))
|
||||
item_with_path.path = str(tmp_path / "song1.mp3")
|
||||
|
||||
item_missing_path = library.add_item(path=str(tmp_path / "song\u2603.mp3"))
|
||||
item_missing_path.path = ""
|
||||
|
||||
dest = tmp_path / "dest"
|
||||
dest.mkdir()
|
||||
|
||||
playlist_path = tmp_path / "test_playlist.m3u"
|
||||
|
||||
items = [item_with_path, item_missing_path]
|
||||
pl_dir = str(playlist_path.parent)
|
||||
|
||||
items_paths = []
|
||||
for item in items:
|
||||
path = item.path if item.path else item.destination(basedir=str(dest))
|
||||
rel_path = os.path.relpath(path, pl_dir)
|
||||
if isinstance(rel_path, bytes):
|
||||
rel_path = rel_path.decode("utf-8", errors="replace")
|
||||
|
||||
items_paths.append(rel_path)
|
||||
|
||||
m3ufile = convert_plugin.M3UFile(playlist_path)
|
||||
m3ufile.set_contents(items_paths)
|
||||
m3ufile.write()
|
||||
|
||||
assert playlist_path.exists()
|
||||
content = playlist_path.read_text(encoding="utf-8")
|
||||
assert "song1.mp3" in content
|
||||
assert "\u2603" in content
|
||||
|
||||
|
||||
@_common.slow_test()
|
||||
class NeverConvertLossyFilesTest(ConvertTestCase, ConvertCommand):
|
||||
|
|
|
|||
Loading…
Reference in a new issue