moehmeni / syncedlyrics

Get an LRC format (synchronized) lyrics for your music
MIT License
188 stars 18 forks source link

Tests fail for macOS #33

Closed moehmeni closed 1 month ago

moehmeni commented 1 month ago

I noticed mac tests fail recently. The error says chardet is missing within requests:

Logs ``` Run poetry run python -m pytest -k "not netease" --durations=0 -vv -s --log-cli-level=DEBUG tests.py ============================= test session starts ============================== platform darwin -- Python 3.12.3, pytest-8.0.2, pluggy-1.4.0 -- /Users/runner/Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/bin/python cachedir: .pytest_cache rootdir: /Users/runner/work/syncedlyrics/syncedlyrics collecting ... collected 0 items / 1 error ==================================== ERRORS ==================================== __________________________ ERROR collecting tests.py ___________________________ ImportError while importing test module '/Users/runner/work/syncedlyrics/syncedlyrics/tests.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: ../../../Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/requests/compat.py:[11](https://github.com/moehmeni/syncedlyrics/actions/runs/8934550625/job/24541629532#step:6:12): in import chardet E ModuleNotFoundError: No module named 'chardet' During handling of the above exception, another exception occurred: ../../../Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.[12](https://github.com/moehmeni/syncedlyrics/actions/runs/8934550625/job/24541629532#step:6:13)/lib/python3.12/site-packages/_pytest/python.py:538: in importtestmodule mod = import_path(path, mode=importmode, root=config.rootpath) ../../../Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/_pytest/pathlib.py:566: in import_path importlib.import_module(module_name) /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/__init__.py:90: in import_module return _bootstrap._gcd_import(name[level:], package, level) :[13](https://github.com/moehmeni/syncedlyrics/actions/runs/8934550625/job/24541629532#step:6:14)87: in _gcd_import ??? :1360: in _find_and_load ??? :1331: in _find_and_load_unlocked ??? :935: in _load_unlocked ??? ../../../Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module exec(co, module.__dict__) tests.py:4: in import syncedlyrics syncedlyrics/__init__.py:13: in from .providers import Deezer, Lrclib, Musixmatch, NetEase, Genius syncedlyrics/providers/__init__.py:3: in from .netease import NetEase syncedlyrics/providers/netease.py:4: in from .base import LRCProvider syncedlyrics/providers/base.py:1: in import requests ../../../Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/requests/__init__.py:45: in from .exceptions import RequestsDependencyWarning ../../../Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/requests/exceptions.py:9: in from .compat import JSONDecodeError as CompatJSONDecodeError ../../../Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/requests/compat.py:13: in import charset_normalizer as chardet ../../../Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/charset_normalizer/__init__.py:24: in from .api import from_bytes, from_fp, from_path, is_binary ../../../Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/charset_normalizer/api.py:5: in from .cd import ( ../../../Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/charset_normalizer/cd.py:[14](https://github.com/moehmeni/syncedlyrics/actions/runs/8934550625/job/24541629532#step:6:15): in from .md import is_suspiciously_successive_range E ImportError: dlopen(/Users/runner/Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/charset_normalizer/md.cpython-312-darwin.so, 0x0002): tried: '/Users/runner/Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/charset_normalizer/md.cpython-312-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/runner/Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/charset_normalizer/md.cpython-312-darwin.so' (no such file), '/Users/runner/Library/Caches/pypoetry/virtualenvs/syncedlyrics-jqk56t8s-py3.12/lib/python3.12/site-packages/charset_normalizer/md.cpython-312-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')) =========================== short test summary info ============================ ERROR tests.py !!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!! =============================== 1 error in 0.[15](https://github.com/moehmeni/syncedlyrics/actions/runs/8934550625/job/24541629532#step:6:16)s =============================== Error: Process completed with exit code 2. ```

I tried to add poetry add chardet and charset for mac tests but even installing them fails:

Logs ``` Run poetry add charset Using version ^1.0.1 for charset Updating dependencies Resolving dependencies... Package operations: 2 installs, 0 updates, 0 removals - Installing chardet (5.2.0) - Installing charset (1.0.1) ChefBuildError Backend subprocess exited when trying to invoke build_wheel running bdist_wheel running build running build_py creating build creating build/lib.macosx-[10](https://github.com/moehmeni/syncedlyrics/actions/runs/9033402760/job/24823681946#step:6:11).9-universal2-cpython-312 creating build/lib.macosx-10.9-universal2-cpython-3[12](https://github.com/moehmeni/syncedlyrics/actions/runs/9033402760/job/24823681946#step:6:13)/charset copying charset/cmd.py -> build/lib.macosx-10.9-universal2-cpython-312/charset copying charset/__init__.py -> build/lib.macosx-10.9-universal2-cpython-312/charset running egg_info writing charset.egg-info/PKG-INFO writing dependency_links to charset.egg-info/dependency_links.txt writing entry points to charset.egg-info/entry_points.txt writing requirements to charset.egg-info/requires.txt writing top-level names to charset.egg-info/top_level.txt reading manifest file 'charset.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching '*.txt' under directory 'docs' warning: no files found matching '*.txt' under directory 'languagedet/data' warning: no files found matching '*.pickle' under directory 'languagedet/data' warning: no files found matching '*.conf' under directory 'languagedet/data' writing manifest file 'charset.egg-info/SOURCES.txt' running build_ext building 'charset.detector' extension creating build/temp.macosx-10.9-universal2-cpython-312 creating build/temp.macosx-10.9-universal2-cpython-312/src creating build/temp.macosx-10.9-universal2-cpython-312/src/mozilladetector clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 -g -Isrc/mozilladetector -I/private/var/folders/3m/p59k4qdj0f17st0gn2cmj3640000gn/T/tmpxa2h0n20/.venv/include -I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c src/charset.detector.cpp -o build/temp.macosx-10.9-universal2-cpython-312/src/charset.detector.o src/charset.detector.cpp:677:5: warning: code will never be executed [-Wunreachable-code] goto __pyx_L3; ^~~~~~~~~~~~~ src/charset.detector.cpp:[13](https://github.com/moehmeni/syncedlyrics/actions/runs/9033402760/job/24823681946#step:6:14)08:5: warning: code will never be executed [-Wunreachable-code] goto __pyx_L20; ^~~~~~~~~~~~~~ src/charset.detector.cpp:2231:24: error: no member named 'curexc_type' in '_ts' tmp_type = tstate->curexc_type; ~~~~~~ ^ src/charset.detector.cpp:2232:25: error: no member named 'curexc_value' in '_ts' tmp_value = tstate->curexc_value; ~~~~~~ ^ src/charset.detector.cpp:2233:22: error: no member named 'curexc_traceback' in '_ts' tmp_tb = tstate->curexc_traceback; ~~~~~~ ^ src/charset.detector.cpp:2234:13: error: no member named 'curexc_type' in '_ts' tstate->curexc_type = type; ~~~~~~ ^ src/charset.detector.cpp:2235:13: error: no member named 'curexc_value' in '_ts' tstate->curexc_value = value; ~~~~~~ ^ src/charset.detector.cpp:2236:13: error: no member named 'curexc_traceback' in '_ts' tstate->curexc_traceback = tb; ~~~~~~ ^ src/charset.detector.cpp:2247:21: error: no member named 'curexc_type' in '_ts' *type = tstate->curexc_type; ~~~~~~ ^ src/charset.detector.cpp:2248:22: error: no member named 'curexc_value' in '_ts' *value = tstate->curexc_value; ~~~~~~ ^ src/charset.detector.cpp:2249:19: error: no member named 'curexc_traceback' in '_ts' *tb = tstate->curexc_traceback; ~~~~~~ ^ src/charset.detector.cpp:2250:13: error: no member named 'curexc_type' in '_ts' tstate->curexc_type = 0; ~~~~~~ ^ src/charset.detector.cpp:2251:13: error: no member named 'curexc_value' in '_ts' tstate->curexc_value = 0; ~~~~~~ ^ src/charset.detector.cpp:2252:13: error: no member named 'curexc_traceback' in '_ts' tstate->curexc_traceback = 0; ~~~~~~ ^ src/charset.detector.cpp:2356:26: warning: 'PyEval_CallObjectWithKeywords' is deprecated [-Wdeprecated-declarations] owned_instance = PyEval_CallObject(type, args); ^ /Library/Frameworks/Python.framework/Versions/3.12/include/python3.12/ceval.h:34:5: note: expanded from macro 'PyEval_CallObject' PyEval_CallObjectWithKeywords((callable), (arg), _PyObject_CAST(_Py_NULL)) ^ /Library/Frameworks/Python.framework/Versions/3.12/include/python3.12/ceval.h:27:1: note: 'PyEval_CallObjectWithKeywords' has been explicitly marked deprecated here Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( ^ /Library/Frameworks/Python.framework/Versions/3.12/include/python3.12/pyport.h:317:54: note: expanded from macro 'Py_DEPRECATED' #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) ^ src/charset.detector.cpp:2395:36: error: no member named 'curexc_traceback' in '_ts' PyObject* tmp_tb = tstate->curexc_traceback; ~~~~~~ ^ src/charset.detector.cpp:2398:21: error: no member named 'curexc_traceback' in '_ts' tstate->curexc_traceback = tb; ~~~~~~ ^ src/charset.detector.cpp:2432:21: error: no member named 'exc_type' in '_ts' *type = tstate->exc_type; ~~~~~~ ^ src/charset.detector.cpp:2433:22: error: no member named 'exc_value' in '_ts' *value = tstate->exc_value; ~~~~~~ ^ src/charset.detector.cpp:2434:19: error: no member named 'exc_traceback' in '_ts' *tb = tstate->exc_traceback; ~~~~~~ ^ src/charset.detector.cpp:2446:24: error: no member named 'exc_type' in '_ts' tmp_type = tstate->exc_type; ~~~~~~ ^ src/charset.detector.cpp:2447:25: error: no member named 'exc_value' in '_ts' tmp_value = tstate->exc_value; ~~~~~~ ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 3 warnings and 20 errors generated. error: command '/usr/bin/clang' failed with exit code 1 at ~/Library/Application Support/pipx/venvs/poetry/lib/python3.12/site-packages/poetry/installation/chef.py:[16](https://github.com/moehmeni/syncedlyrics/actions/runs/9033402760/job/24823681946#step:6:17)4 in _prepare 160│ 161│ error = ChefBuildError("\n\n".join(message_parts)) 162│ 163│ if error is not None: → 164│ raise error from None 165│ 166│ return path 167│ 168│ def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path: Note: This error originates from the build backend, and is likely not a problem with poetry but with charset (1.0.1) not supporting PEP 5[17](https://github.com/moehmeni/syncedlyrics/actions/runs/9033402760/job/24823681946#step:6:18) builds. You can verify this by running 'pip wheel --no-cache-dir --use-pep517 "charset (==1.0.1)"'. ```

MacOS test are disabled for now. PR or a solution is appreciated.

moehmeni commented 1 month ago

I ran poetry lock, pushed, and it solved it. Probably the problem was for some deprecated versions of Python packages.