-
-
Notifications
You must be signed in to change notification settings - Fork 69
AttributeError: '_QtApi' object has no attribute 'QtCore' #166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Your code snippet doesn't call |
|
Since |
I am also wondering whether there is a particular reason to implement yet another shim layer for Qt, when we already have stable alternatives such as |
This is with the plugin already installed? As for your question: Because we need lazy loading, and also see #130 (comment) |
What do you mean? The You can achieve the same setup by running:
|
I see, I can reproduce it with that setup. In all other configurations I tried, pytest picked up the plugin and thus tests succeeded. |
So, any idea how I can get the tests running in my case? Also, assuming the package is now installed, are there any specific instructions for running the tests besides a call to |
Simply running When developing we usually use |
So if it works on the root tree, but not for out-of-tree builds, then there is something fragile in the tests setup.
Tox is just responsible for automation, the tests should work regardless of whether the necessary environment is setup by tox or by hand, correct?
Indeed. We have already got packaging build scripts, which are responsible for running the builds against the supported versions of Python, setting up the tests and running them. |
Also, if I now run the tests against the installed package with
|
That test actually needs a window manager running. I'm not sure if there's a better check we could have there to ensure that's actually the case. |
Hi guys, sorry for the delay. @ghisvail, def pytest_configure(config):
...
qt_api.set_qt_api(config.getini('qt_api')) This does not seem to be happening in your environment, that's why you are seeing that error. pytest uses setuptools entry points to load installed plugins, and the output from your session hints that this mechanism is not working win your environment:
You should see a header like this instead:
(Notice the You can also execute the below to verify this: >>> from pkg_resources import iter_entry_points
>>> list(iter_entry_points('pytest11'))
[EntryPoint.parse('pytest-qt = pytestqt.plugin')] I'm guessing that Please note that you will probably have the same problems with all Having said all that, there are ways to force pytest to load a plugin:
pytest_plugins = 'pytestqt.plugin' But please note that either way you will need
That depends, you still need to setup the necessary environment correctly; |
Perhaps using a custom marker, something like |
@nicoddemus You can actually get the plugin detected by doing this additional step:
With these steps, you can now run in >>> from pkg_resources import iter_entry_points
>>> list(iter_entry_points('pytest11'))
[EntryPoint.parse('pytest-qt = pytestqt.plugin')] It still does not succeed, so I am giving up on getting the tests run at build time and run them as a CI service on the installed Debian packages. |
That's nice to know, thanks.
What happens, the plugin is still not loaded?
Well OK then. I'm closing this for now. Thanks for trying so hard to get the tests to run though. |
Running:
results in the following error:
This error arises when
pytest
collects the test cases fromtests/test_modeltest.py
.The text was updated successfully, but these errors were encountered: