-
Notifications
You must be signed in to change notification settings - Fork 347
InternalError and AssertionError with non-django tests #190
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
On further research, manually deactivating the plugin with a parameter |
I still consider this a bug with pytest-django - re-opening. |
I think that this bug is related to not setting |
Why would you want to do this for a non-Django project? I think that Changing this breaks some existing tests however. |
The issue can be reproduced by just installing the following packages alongside:
Then even As far as I can see it's caused by pytest-splinter importing "django" when |
Importing things from Django without having called pytest-django must be the first to import Django and call We should probably introduce an assertion " I did a quick hack to delay the Django import in splinter and it solved the problem. I think it makes sense for splinter to delay imports of Django, Zope and Flask anyways until they are actually requested. pytest-splinter could also be changed to delay the import of splinter into hooks. Tricky issue, what are your thoughts? |
Just importing "django" for detecting if it's installed, like pytest-splinter does, is supported by Django, isn't it?
I've gave it a shot in ac2b3c7. |
You are right, I didn't notice that splinter actually deferred the other imports (importing Client), so the problem does not lie in splinter or pytest-splinter. |
So #200 makes sense? |
It looks very good, feel free to merge! Good job tracking this down, these issues are very "interesting" :) I am not sure, OTOH, as long as Either checks is fine by me :-) |
👍 |
Please excuse my delayed reply. Yes, I can confirm that this fix has indeed solved my issue. |
Thanks, @klvbdmh. |
After installing pytest-django I cannot run my old tests on a simple scrapper. The scrapper's project consists of five files:
__init__.py
,scrap.py
,test_scrap.py
,output.txt
, andtest.txt
. The test works by comparing the two text files. As you can see it's a very simple project and it doesn't use django at all.When I run
test_scrap.py
with pytest I get the following error:Tests in a separate django project work with no problems after following the configuration procedure. It's just non-django projects I have problems with.
I'm using the latest stable versions of both pytest and pytest-django, Python 3.4, and Windows 7.
After uninstalling pytest-django plugin my non-django scrapper test works again.
The text was updated successfully, but these errors were encountered: