spleeter
spleeter copied to clipboard
Windows 10 - I can't run the tests with 'poetry run pytest tests/'
Hello all,
I've tried everything I can - different python versions, fresh environments, etc. but I can't get the tests to run from the command line. Can anyone give me some suggestions, based upon this output? I would super appreciate it.
(py3812) C:\Python\spleeter>poetry run pytest tests/ ===================================================================== test session starts ===================================================================== platform win32 -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- C:\Anaconda\envs\py3812\python.exe cachedir: .pytest_cache rootdir: C:\Python\spleeter, configfile: pyproject.toml plugins: anyio-3.5.0, forked-1.4.0 collected 53 items
tests/test_command.py::test_version INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages_pytest\main.py", line 269, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages_pytest\main.py", line 323, in _main INTERNALERROR> config.hook.pytest_runtestloop(session=session) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pluggy_hooks.py", line 265, in call INTERNALERROR> return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pluggy_manager.py", line 80, in _hookexec INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pluggy_callers.py", line 60, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pluggy_result.py", line 60, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pluggy_callers.py", line 39, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages_pytest\main.py", line 348, in pytest_runtestloop INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pluggy_hooks.py", line 265, in call INTERNALERROR> return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pluggy_manager.py", line 80, in _hookexec INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pluggy_callers.py", line 60, in multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pluggy_result.py", line 60, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pluggy_callers.py", line 39, in multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pytest_forked_init.py", line 51, in pytest_runtest_protocol INTERNALERROR> reports = forked_run_report(item) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\pytest_forked_init.py", line 73, in forked_run_report INTERNALERROR> ff = py.process.ForkedFunc(runforked) INTERNALERROR> File "C:\Anaconda\envs\py3812\lib\site-packages\py_process\forkedfunc.py", line 45, in init INTERNALERROR> pid = os.fork() INTERNALERROR> AttributeError: module 'os' has no attribute 'fork'
=================================================================== no tests ran in 10.05s ==================================================================== Exception ignored in: <function ForkedFunc.del at 0x000002123589CA60> Traceback (most recent call last): File "C:\Anaconda\envs\py3812\lib\site-packages\py_process\forkedfunc.py", line 110, in del if self.pid is not None: # only clean up in main process AttributeError: 'ForkedFunc' object has no attribute 'pid'
(py3812) C:\Python\spleeter>
Any thoughts? Thanks!
Hi @robertmckean, this seems to be because pytest-forked is used instead of pytest (for making the test faster) and that pytest-forked is not supported on Windows as Windows does not provide a fork mechanism. I then see two workaround:
- Run the test within a docker container (using for instance one of the provided images)
- replace "pytest-forked" by "pytest" in the pyproject.toml file (but it's unlikely that a PR with this modification will be accepted).