mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 12:02:41 +01:00
Remove redundant lyrics test files
This commit is contained in:
parent
3b73a26002
commit
29a3dd5084
4 changed files with 7 additions and 2298 deletions
|
|
@ -1,60 +0,0 @@
|
|||
# This file is part of beets.
|
||||
# Copyright 2016, Fabrice Laporte
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining
|
||||
# a copy of this software and associated documentation files (the
|
||||
# "Software"), to deal in the Software without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
||||
# permit persons to whom the Software is furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be
|
||||
# included in all copies or substantial portions of the Software.
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import requests
|
||||
|
||||
from test.plugins import test_lyrics
|
||||
|
||||
|
||||
def mkdir_p(path):
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError:
|
||||
if os.path.isdir(path):
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def safe_open_w(path):
|
||||
"""Open "path" for writing, creating any parent directories as needed."""
|
||||
mkdir_p(os.path.dirname(path))
|
||||
return open(path, "w")
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
"""Download one lyrics sample page per referenced source."""
|
||||
if argv is None:
|
||||
argv = sys.argv
|
||||
print("Fetching samples from:")
|
||||
for s in test_lyrics.GOOGLE_SOURCES + test_lyrics.DEFAULT_SOURCES:
|
||||
print(s["url"])
|
||||
url = s["url"] + s["path"]
|
||||
fn = test_lyrics.url_to_filename(url)
|
||||
if not os.path.isfile(fn):
|
||||
html = requests.get(
|
||||
url,
|
||||
verify=False,
|
||||
timeout=10,
|
||||
).text
|
||||
with safe_open_w(fn) as f:
|
||||
f.write(html.encode("utf-8"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
|
@ -20,7 +20,6 @@ import re
|
|||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import confuse
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
|
|
@ -195,7 +194,13 @@ class LyricsPluginTest(unittest.TestCase):
|
|||
assert lyrics._scrape_merge_paragraphs(text) == "one\ntwo\nthree"
|
||||
|
||||
def test_missing_lyrics(self):
|
||||
assert not google.is_lyrics(LYRICS_TEXTS["missing_texts"])
|
||||
lyrics = """
|
||||
Lyricsmania staff is working hard for you to add $TITLE lyrics as soon
|
||||
as they'll be released by $ARTIST, check back soon!
|
||||
In case you have the lyrics to $TITLE and want to send them to us, fill out
|
||||
the following form.
|
||||
"""
|
||||
assert not google.is_lyrics(lyrics)
|
||||
|
||||
|
||||
def url_to_filename(url):
|
||||
|
|
@ -225,8 +230,6 @@ class MockFetchUrl:
|
|||
|
||||
|
||||
LYRICS_ROOT_DIR = os.path.join(_common.RSRC, b"lyrics")
|
||||
yaml_path = os.path.join(_common.RSRC, b"lyricstext.yaml")
|
||||
LYRICS_TEXTS = confuse.load_yaml(yaml_path)
|
||||
|
||||
|
||||
class LyricsGoogleBaseTest(unittest.TestCase):
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +0,0 @@
|
|||
# Song used by LyricsGooglePluginMachineryTest
|
||||
|
||||
missing_texts: |
|
||||
Lyricsmania staff is working hard for you to add $TITLE lyrics as soon
|
||||
as they'll be released by $ARTIST, check back soon!
|
||||
In case you have the lyrics to $TITLE and want to send them to us, fill out
|
||||
the following form.
|
||||
Loading…
Reference in a new issue