Comments (8)
I decided to look into this issue after just dealing with it for what seems like years.
What happens is that the tests run fine, but fail to delete the test database because of the other session(s) using database error. If you run the tests again, django prompts you to delete the test database before continuing. This is how I've always just dealt with it in the past.
All of my regular Django tests work fine, it is only tests run with behave-django that exhibit this issue.
- Django 2.1.4
- behave-django 1.1.0
- PostgreSQL 10.1
I'll try and remember to come up with a minimal reproducing project soon.
from behave-django.
I can't remember if this is the solution to the problem I had when I originally commented on this issue, but I came across this issue again in my Googlin' and this time I have a solution to a very similar issue...or maybe even the same issue.
Add conn_max_age=0
to your database configuration in tests. I figured this out from this answer on SO.
from behave-django.
This is probably not related to behave-django as such. You'd have to provide more details, though, ideally steps to reproduce the error.
You may find more helpful hints in similar issues on the web, e.g.
- Django Test — Unable to drop and recreate test database (StackOverflow)
- https://code.djangoproject.com/ticket/22420
- Fantomas42/django-blog-zinnia#476
- Concurrent Jenkins builds of a Django application (a blog)
- grosser/parallel_tests#412
The last issue suggests that the problem is related to Postgres alone, not even Django. At least the error message comes directly from there. Some other application may use your database while you run the tests.
Please let us know when you find the culprit, so others can profit too. I leave the issue open in the meantime.
from behave-django.
Closing this issue for lack of activity.
from behave-django.
That sounds like an interesting background for learning more about the issue. (Thanks for digging!)
Please also mention any other technology that may be involved (e.g. Selenium) and the environment that the failing tests are run in. (I guess, a successfully failing test project to reproduce the issue will exhibit all of that.)
behave-django isn't much "magic", it's mostly just glue code between test tools. I wouldn't be surprised to find a generic issue that can be reproduced without behave-django.
from behave-django.
@dmwyatt Did you look into this more? Just wondering b/c I'm running into the same error.
from behave-django.
No, I got caught up in another project that doesn't use behave. Once I get back to a behave-using project I'll be able to investigate.
from behave-django.
Thanks @dmwyatt!
Details to this setting are available from the Databases section in Django's documentation.
I'm closing this issue as sufficiently discussed.
from behave-django.
Related Issues (20)
- Documentation of django_ready hook incorrectly lists "scenario" as a second positional argument HOT 2
- Fixtures silently do nothing when --simple is specified, and no documentation calls this out HOT 10
- Getting more programmatic flexibility on the testcase type used in scenarios HOT 4
- Cleanup of custom permissions between scenarios HOT 1
- multiple features and before_all initial setup HOT 2
- how to assess test case code coverage? HOT 5
- Testing ASGI Django HOT 5
- Custom Runner e TestCase HOT 19
- Add support for customized LiveServerTestCase with selenium-hub support HOT 1
- Support latest stable version of Python and Django
- Use GitHub Actions CI HOT 1
- Looking for (co-)maintainer! 🔥🙏🦠🔥🐍 HOT 3
- Tables are not created for test_database while running behave test HOT 3
- Investigate potential bug in `environment.get_url()`
- Inconsistent when using behave --simple HOT 1
- Objects not only being created in test database
- Behave v1.2.7.dev3 breaks management command HOT 5
- NEEDS: .readthedocs.yaml config-file soon (before 2023-09) HOT 1
- Coverage advice breaks m2m queries. HOT 2
- Dependency on Behave blocks release on PyPI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from behave-django.