pytest-dev / pytest-dev/pytest-qt
Import error when running tests
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 455
- Forks
- 72
- Avg merge
- 12h 26m
- Merged PRs (30d)
- 1
Description
When running any pytest I receive the following error
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/_pytest/main.py", line 264, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/_pytest/config/__init__.py", line 992, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/pluggy/_hooks.py", line 277, in call_historic
INTERNALERROR> res = self._hookexec(self.name, self.get_hookimpls(), kwargs, False)
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/pytestqt/plugin.py", line 203, in pytest_configure
INTERNALERROR> qt_api.set_qt_api(config.getini("qt_api"))
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/pytestqt/qt_compat.py", line 75, in set_qt_api
INTERNALERROR> self.pytest_qt_api = self._get_qt_api_from_env() or api or self._guess_qt_api()
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/pytestqt/qt_compat.py", line 64, in _guess_qt_api
INTERNALERROR> if _can_import("PySide6.QtCore"):
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/pytestqt/qt_compat.py", line 56, in _can_import
INTERNALERROR> _import(name)
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/pytestqt/qt_compat.py", line 23, in _import
INTERNALERROR> return __import__(name)
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/shiboken2/files.dir/shibokensupport/__feature__.py", line 145, in _import
INTERNALERROR> return original_import(name, *args, **kwargs)
INTERNALERROR> File "/test/.venv/lib/python3.9/site-packages/IPython/external/qt_loaders.py", line 65, in find_spec
INTERNALERROR> raise ImportError(
INTERNALERROR> ImportError:
INTERNALERROR> Importing PySide6 disabled by IPython, which has
INTERNALERROR> already imported an Incompatible QT Binding: pyside2
I suspect it has something to do with the Ipython package that is being used as well. Here is the full list of installed dependencies
[tool.poetry.dependencies]
python = ">=3.9,<3.10"
importlib-metadata = "^4.11.2"
ipython = "^8.1.1"
matplotlib = "^3.5.1"
mypy = "^0.931"
mypy-extensions = "^0.4.3"
Pygments = "^2.11.2"
qiskit = "^0.34.2"
pylatexenc = "^2.10"
qtconsole = "^5.2.2"
Rx = "^3.2.0"
typed-ast = "^1.5.2"
typing-extensions = "^4.1.1"
zipp = "^3.7.0"
marshmallow = "^3.14.1"
marshmallow-enum = "^1.5.1"
marshmallow-dataclass = "^8.5.3"
yapf = "^0.32.0"
pre-commit = "^2.17.0"
pytest-qt = "^4.0.2"
pytest = "^7.0.1"
appdirs = "^1.4.4"
PySide2 = "^5.15.2"
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pytest-qt traceback at pytestqt/plugin.py and pytestqt/qt_compat.py, then review the listed Poetry dependencies, especially IPython, pytest-qt, and PySide2. Reproduce the failure by running pytest in the reported Python 3.9 environment and determine the dependency or binding conflict that prevents test configuration from completing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100