Comments (8)
Now that we switched to using pytest.main
, we can mock/monkeypatch it?
from pytest-watch.
(Btw I would also refactor the code so that you don't have to pass a gazillion of parameters twice, first from main
to watch
and then to ChangeHandler
, the watch
itself could be a handler's method, why not?)
from pytest-watch.
I would use pytest/tox for testing and set up builds on travis and appveyor -- this way we'll test it on win/linux for all interpreter versions.
from pytest-watch.
Now that we switched to using pytest.main, we can mock/monkeypatch it
Interesting. Maybe. If it's our own custom monkey-patching code, it seems like a big place to make mistakes. I think integration tests are going to find many more bugs than unit tests in our case. We don't have too many functions to tests (but by all means, we should still test those).
For making sure that ptw --poll -- myfile
still works though, it might make more sense not to try to go around py.test
(since it's error prone), but use it in the tests so we're guaranteed that we haven't broken anything. Something that runs ptw
top-level with a timeout and observes STDOUT.
Then we should also add tests for multiple ptw / py.test version combinations. So the combinations would be ptw version, py.test version, Linux | Mac | Windows, Python 2.7 | 3.2? | 3.3? | 3.4 | 3.5. (Let's only include earlier versions of 3 if we already support it :-)
What do you think?
Btw I would also refactor the code so that you don't have to pass a gazillion of parameters twice, first from main to watch and then to ChangeHandler, the watch itself could be a handler's method, why not?
Yeah, agreed. It's time to refactor.
from pytest-watch.
What if we just mock pytest.main
as @aldanor said and check whether the parameters provided are correct? Good thing about mocking, we dont need much of our own code to prepare the mock.
With that said, our subprocess call to py.test
probably wont pick up the mocked pytest.main
, we need to subprocess call something like our mocked py.test-mock
executable, by setting -runner
Also, some way to run pytest main loop just once instead of the infinite watching loop, using timeouts always is not desirable.
from pytest-watch.
Hello,
can I proceed with some tests over main and parameters parsing?
I want to try some tests on #65, but before I need some basic tests coverage to keep current plugin funcionality.
Do you have some WIP on this issue or can I start here from zero?
Initially, I aim to test only for Linux + python 3+.
Thanks.
from pytest-watch.
Maybe take a look at #37 ?
Added this small config tests long back, so please feel free to take over.
Short note regarding the PR:
- Please ignore
test_works_directories_ini_option
check - We decided to not do it - #41 . - This only tests the config - doesn't ensure that ptw actually works with pytest - as mentioned above (#14 (comment))
Completely out of context now, but @joeyespo can suggest other things we need to fix there,
from pytest-watch.
Good!
I started from the basics before any step forward.
Initial test cases are being applied to CLI arguments, aiming to cover all pytest_watch.command file.
I agree with and am following #14 comment about focus on ptw functional, before integration. It sounds the best for the moment.
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.