pytest-concurrent icon indicating copy to clipboard operation
pytest-concurrent copied to clipboard

ImportError: cannot import name 'Junit' from '_pytest.junitxml'

Open beauji1116jbn opened this issue 3 years ago • 0 comments
trafficstars

When i try to run pytest i got this error: command:

python3 -m pytest --durations=0 --tb=short -n 8 -s

output:

Traceback (most recent call last):
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/pytest/__main__.py", line 5, in <module>
    raise SystemExit(pytest.console_main())
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/config/__init__.py", line 187, in console_main
    code = main()
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/config/__init__.py", line 145, in main
    config = _prepareconfig(args, plugins)
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/config/__init__.py", line 324, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/helpconfig.py", line 102, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/config/__init__.py", line 1016, in pytest_cmdline_parse
    self.parse(args)
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/config/__init__.py", line 1304, in parse
    self._preparse(args, addopts=addopts)
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/config/__init__.py", line 1187, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/pluggy/_manager.py", line 287, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/assertion/rewrite.py", line 168, in exec_module
    exec(co, module.__dict__)
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/pytest_concurrent/plugin.py", line 5, in <module>
    from pytest_concurrent.modes import factory
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/assertion/rewrite.py", line 168, in exec_module
    exec(co, module.__dict__)
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/pytest_concurrent/modes/__init__.py", line 2, in <module>
    from .mproc import MultiProcessMode as mproc
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/assertion/rewrite.py", line 168, in exec_module
    exec(co, module.__dict__)
  File "/Users/foo/Library/Python/3.8/lib/python/site-packages/pytest_concurrent/modes/mproc.py", line 9, in <module>
    from _pytest.junitxml import Junit
ImportError: cannot import name 'Junit' from '_pytest.junitxml' (/Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/junitxml.py)

macOS version: 12.4 python version: 3.8.9 pytest version: 7.1.2 pytest-concurrent version: 0.2.2

and i checked in file /Users/foo/Library/Python/3.8/lib/python/site-packages/_pytest/junitxml.py and there's no Junit

plz help on this, thx

beauji1116jbn avatar Jul 07 '22 17:07 beauji1116jbn