Comments (9)
That's an interesting case. I think that'd be a good thing to handle.
Any idea how pytest works with --ipdb
? Namely, does the pytest process remain running until the debug session is over? (I would think it does.) If so, it might be worth adding an --ipdb
argument that gets forwarded to pytest and also signals to ptw
to wait for the process to finish.
What do you think, @Glueon?
from pytest-watch.
Yes, pytest keeps running when it is in the ipdb.
I do not know if a forwarded --ipdb
option is a good solution, because py.test can be dropped into debugger from code with something like import ipdb; ipdb.set_trace()
.
But I think you can just block ptw in all cases untill pytest finishes. Then --ipdb
forwarding will be redundant.
from pytest-watch.
Yes, pytest keeps running when it is in the ipdb
Excellent.
because py.test can be dropped into debugger from code with something like import ipdb; ipdb.set_trace()
Ah, very true. Good point.
But I think you can just block ptw in all cases untill pytest finishes
I thought about that initially before replying. The downside is then you sacrifice the feature of cancelling a long-running testsuite when you save a file. It's a nice feature of ptw
so you don't have to wait for the tests to finish before running them again with the latest code.
Another approach would be to add a --wait
/ -w
argument to tell ptw to wait for cases like this. (I'm sure --ipbd
won't be the only one.)
from pytest-watch.
I think -w
approach is better. If someone relies on cancellation functionality you won't break anything introducing it.
from pytest-watch.
It may also make sense to suspend any pytest re-runs until the currently running pytest process has finished (although the events can still be collected / spooled). Maybe just make that a default option to avoid yet another command line arg.
from pytest-watch.
It may also make sense to suspend any pytest re-runs until the currently running pytest process has finished
@aldanor I personally work on some bigger projects with long-running test suites. The cancelling behavior is really nice in these cases since it nearly doubles the time running tests, which can be significant. But you're right, it'd be best to not introduce an option if we can avoid it. I wonder if there's a simple cross-platform way to detect whether py.test
is running vs ipdb
/ something else. That would make running tests cancellable, but wait on child / spawned processes.
If there's no other option, I think I'd still prefer cancel-by-default over a new CLI argument. Have any other ideas?
from pytest-watch.
Question for you. If signal.SIGTERM
is sent to a Python process in a debug session, will it terminate or keep running until you explicitly exit with a command?
from pytest-watch.
If signal.SIGTERM is sent to a Python process in a debug session, will it terminate or keep running until you explicitly exit with a command?
For reference, with --pdb
, it terminates your debugging session after you enter a command.
from pytest-watch.
Fixed with 18a99b8, which adds --wait
. (This was enabled by 0cf6b93, which ensures only one instance of pytest is running, and 6e07f80, which gracefully terminates a test run with KeyboardInterrupt
which --wait
overrides.)
Just published v4.0, which includes these changes. Feel free to re-open if there's still an issue!
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.