Skip to content

Database errors BEFORE running tests #2713

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

Closed
KayaLukenIncapptic opened this issue Aug 23, 2017 · 2 comments
Closed

Database errors BEFORE running tests #2713

KayaLukenIncapptic opened this issue Aug 23, 2017 · 2 comments

Comments

@KayaLukenIncapptic
Copy link

KayaLukenIncapptic commented Aug 23, 2017

When running pytest, I get "no DB access error" caused by modules evaluated during import.
The suggestion is to mark tests with pytest.mark.django_db or use db fixture

But I cant do this, as error occurs BEFORE any test is actually run!

I also get DB errors in other modules that are imported at this time, but this is an different error caused by improper settings (using test_settings instead of settings).

So during the same sequence of imports, pytest attempts to use main database in some cases, and test database in other cases, neither behaviour is desirable.

amqp (2.1.4)
apipkg (1.4)
appnope (0.1.0)
asn1crypto (0.22.0)
beautifulsoup4 (4.6.0)
billiard (3.5.0.2)
biplist (1.0.1)
boto3 (1.4.4)
botocore (1.5.31)
bs4 (0.0.1)
celery (4.0.2)
cffi (1.9.1)
contextlib2 (0.5.5)
coverage (4.3.4)
cryptography (1.7.1)
decorator (4.0.11)
Django (1.9.1)
django-bootstrap3 (8.1.0)
django-countries (4.6.1)
django-ipware (1.1.6)
django-polymorphic (1.0.2)
django-solo (1.1.2)
django-waffle (0.11.1)
docutils (0.13.1)
execnet (1.4.1)
gunicorn (19.6.0)
humanfriendly (2.4)
idna (2.2)
ios-resigner (0.2.10)
ipdb (0.10.3)
ipython (6.1.0)
ipython-genutils (0.2.0)
jedi (0.10.2)
jmespath (0.9.2)
kombu (4.0.2)
libmagic (1.0)
newrelic (2.78.0.57)
olefile (0.44)
pep8 (1.7.0)
pexpect (4.2.1)
pickleshare (0.7.4)
Pillow (4.0.0)
pip (9.0.1)
prompt-toolkit (1.0.14)
psycopg2 (2.7.1)
ptyprocess (0.5.1)
py (1.4.32)
pyasn1 (0.1.9)
pycparser (2.17)
pycrypto (2.6.1)
Pygments (2.2.0)
pyOpenSSL (16.2.0)
pytest (3.0.5)
pytest-cov (2.4.0)
pytest-django (3.1.2)
pytest-mock (1.5.0)
pytest-xdist (1.15.0)
python-dateutil (2.6.0)
python-magic (0.4.12)
pytz (2016.10)
raven (6.1.0)
redis (2.10.5)
requests (2.12.4)
s3transfer (0.1.10)
selenium (3.3.3)
semantic-version (2.6.0)
setuptools (36.2.7)
simplegeneric (0.8.1)
six (1.10.0)
traitlets (4.3.2)
ua-parser (0.7.3)
user-agents (1.1.0)
vine (1.1.3)
wcwidth (0.1.7)
wheel (0.24.0)

Mac OS Sierra 10.12.6

@KayaLukenIncapptic KayaLukenIncapptic changed the title Database error BEFORE running tests Database errors BEFORE running tests Aug 23, 2017
@The-Compiler
Copy link
Member

pytest itself doesn't do anything about databases, so a better place for this would probably be the pytest-django issue tracker. However, without seeing what code you're running and the output you're getting, I doubt anyone is going to be able to help 😉

@nicoddemus
Copy link
Member

@KayaLukenIncapptic as @The-Compiler suggested, this should be posted on pytest-django.

Closing this then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants