Comments (6)
Oh wow, that would be problematic. Thanks for opening the issue.
Tests should absolutely have the ability to be run in parallel though. I wonder if this particular symptom is a case of hard-coding the test database path when you should really be using a random temp file (or sqlite:///:memory:
).
Would using one of those techniques fix the test database already exists
problem?
from pytest-watch.
pytest-django automatically creates and gives names to databases. It supports xdist out of the box so maybe it understands that if tests run in parallel it should create several different databases.
But when you manually spin up two py.test instances in parallel it has zero knowledge about this, therefore it tries to create a django_pytest_1
db for the first test and fails because another py.test instance has already created it. xdist does not run tests twice.
That's only my guess but I think that this unwapted py.test process duplication is a problem which can theoretically lead to all sorts of problems.
from pytest-watch.
Nice, I didn't know pytest-django created databases that way. Thanks for clarifying that.
xdist also has the ability to run multiple subprocesses, so pytest-watch shouldn't have a problem with that either.
It seems like a low-level design flaw if running py.test
twice causes the tests to fail. That's why I suggested creating a fresh database (as opposed to creating a "database" with a unique name within an existing database system--it seems you can only really do this with sqlite or by running postgresql / mysql within a Docker container), since it's analogous to an Immutable Server.
As for pytest-watch, it's possible to patch the underlying problem by waiting for the previous test process to finish. But since I see that as a disadvantage (since the full test suite will be run each time you press "save"), I wonder if there's a middleground. Perhaps when a restart is detected, a "stop" signal can be sent to the existing test process, and then we wait for that process to stop before running the tests again.
What do you think about that approach?
from pytest-watch.
Isn't it possible to block pytest-watch from restarting if py-test dropped into the IPDB session or is running? Like we disussed earlier.
from pytest-watch.
I'm having a similar problem. I think waiting for the initial test to respond to the stop signal would be sufficient, and more optimal than waiting for the entire suite to finish.
from pytest-watch.
Merging this into the more general issue #36.
Thanks for your thoughts on this.
from pytest-watch.
Related Issues (20)
- broken link in the README: saythanks
- How to use with poetry? HOT 3
- Run ptw with -s HOT 3
- pytest watch seems to fail when pyproject.toml is used as a config file HOT 7
- Logging error when running pytest in pytest-watch HOT 1
- Integration with pytest-cov HOT 2
- My ptw doesn't "watch" subdirectories
- Running from "python -m pytest_watch" does not add current path to PYTHONPATH HOT 1
- ignore `Client.dataset is deprecated` warnings
- Maintenance Status? HOT 4
- pytest 7.0: AttributeError: 'dict' object has no attribute 'config' HOT 3
- error:'str' object has no attribute 'plate_num'
- Specify `python_requires` in the distribution package metadata
- Runner argument not parsed correctly on windows
- Error in Python 3.10: `module 'collections' has no attribute 'MutableSet'` HOT 5
- `ImportError` when running tests using `ptw` HOT 2
- Directories passed to pytest-watch are also passed to pytest, but shouldn't be
- sdist is missing LICENSE
- When I install pytest-watch with Python 3.11 and pip 22.3.1 I see deprecation warning HOT 1
- GO TO PYTEST-WATCHER HOT 1
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 pytest-watch.