kevlened / pytest-parallel

A pytest plugin for parallel and concurrent testing
https://github.com/browsertron/pytest-parallel/issues/104#issuecomment-1293941066
MIT License
313 stars 60 forks source link

Using the command line to execute the script in windows, an error is reported #78

Open chineseluo opened 4 years ago

chineseluo commented 4 years ago

Test session starts (platform: win32, Python 3.8.2, pytest 5.4.1, pytest-sugar 0.9.4) rootdir: D:\TestScriptDir\pyqt5_study plugins: allure-pytest-2.8.13, forked-1.2.0, html-2.1.1, metadata-1.8.0, ordering-0.6, parallel-0.1.0, repeat-0.8.0, rerunfailures-9.0, sugar-0.9.4, xdist-1.32.0 collecting ... pytest-parallel: 1 worker (process), 2 tests per worker (threads) INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\site-packages_pytest\main.py", line 191, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\site-packages_pytest\main.py", line 247, in _main INTERNALERROR> config.hook.pytest_runtestloop(session=session) INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\site-packages\pluggy\hooks.py", line 286, in call INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\site-packages\pluggy\manager.py", line 84, in INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall( INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\site-packages\pluggy\callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\site-packages\pluggy\callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\site-packages\pytest_parallel__init__.py", line 302, in pytest_runtestloop INTERNALERROR> process.start() INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\multiprocessing\process.py", line 121, in start INTERNALERROR> self._popen = self._Popen(self) INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 224, in _Popen INTERNALERROR> return _default_context.get_context().Process._Popen(process_obj) INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\multiprocessing\context.py", line 326, in _Popen INTERNALERROR> return Popen(process_obj) INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\multiprocessing\popen_spawn_win32.py", line 93, in init INTERNALERROR> reduction.dump(process_obj, to_child) INTERNALERROR> File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\multiprocessing\reduction.py", line 60, in dump INTERNALERROR> ForkingPickler(file, protocol).dump(obj) INTERNALERROR> AttributeError: Can't pickle local object 'pytest_addoption..label_type..a_label_type'

Results (0.26s): Exception in thread Thread-1: Traceback (most recent call last): File "", line 1, in File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 107, in spawn_main new_handle = reduction.duplicate(pipe_handle, File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\multiprocessing\reduction.py", line 79, in duplicate return _winapi.DuplicateHandle( OSError: [WinError 6] 句柄无效。 Fatal Python error: could not acquire lock for <_io.BufferedWriter name=''> at interpreter shutdown, possibly due to daemon threads Python runtime state: finalizing (tstate=000001D863DD9070)

Thread 0x000015dc (most recent call first): File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\threading.py", line 1202 in invoke_excepthook File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\threading.py", line 934 in _bootstrap_inner File "C:\Users\luozhongwen\AppData\Local\Programs\Python\Python38\lib\threading.py", line 890 in _bootstrap

Current thread 0x00001eb4 (most recent call first):

iamtech123 commented 3 years ago

I am also facing same kind of error. Could you please help!

platform win32 -- Python 3.7.7, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: C:\Git\python-pytest-bdd, configfile: pytest.ini plugins: bdd-4.0.2, forked-1.3.0, html-3.1.1, html-reporter-0.2.6, metadata-1.11.0, parallel-0.1.0, xdist-2.3.0
collected 7 items pytest-parallel: 1 worker (process), 2 tests per worker (threads) INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "c:\users\user1.virtualenvs\python-pytest-bdd-8g8otlzx\lib\site-packages_pytest\main.py", line 269, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "c:\users\user1.virtualenvs\python-pytest-bdd-8g8otlzx\lib\site-packages_pytest\main.py", line 323, in _main INTERNALERROR> config.hook.pytest_runtestloop(session=session) INTERNALERROR> File "c:\users\user1.virtualenvs\python-pytest-bdd-8g8otlzx\lib\site-packages\pluggy\hooks.py", line 286, in call INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "c:\users\user1.virtualenvs\python-pytest-bdd-8g8otlzx\lib\site-packages\pluggy\manager.py", line 93, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "c:\users\user1.virtualenvs\python-pytest-bdd-8g8otlzx\lib\site-packages\pluggy\manager.py", line 87, in INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, INTERNALERROR> File "c:\users\user1.virtualenvs\python-pytest-bdd-8g8otlzx\lib\site-packages\pluggy\callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "c:\users\user1.virtualenvs\python-pytest-bdd-8g8otlzx\lib\site-packages\pluggy\callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "c:\users\user1.virtualenvs\python-pytest-bdd-8g8otlzx\lib\site-packages\pluggy\callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "c:\users\user1.virtualenvs\python-pytest-bdd-8g8otlzx\lib\site-packages\pytest_parallel__init__.py", line 302, in pytest_runtestloop INTERNALERROR> process.start() INTERNALERROR> File "c:\python377\lib\multiprocessing\process.py", line 112, in start INTERNALERROR> self._popen = self._Popen(self) INTERNALERROR> File "c:\python377\lib\multiprocessing\context.py", line 223, in _Popen INTERNALERROR> return _default_context.get_context().Process._Popen(process_obj) INTERNALERROR> File "c:\python377\lib\multiprocessing\context.py", line 322, in _Popen INTERNALERROR> return Popen(process_obj) INTERNALERROR> File "c:\python377\lib\multiprocessing\popen_spawn_win32.py", line 89, in init INTERNALERROR> reduction.dump(process_obj, to_child) INTERNALERROR> File "c:\python377\lib\multiprocessing\reduction.py", line 60, in dump INTERNALERROR> ForkingPickler(file, protocol).dump(obj) INTERNALERROR> AttributeError: Can't pickle local object 'ArgumentParser.init..identity'