-
Notifications
You must be signed in to change notification settings - Fork 278
test_repository_tool: Add missing clear_all flag #1067
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
test_repository_tool: Add missing clear_all flag #1067
Conversation
Thanks for the patch @jku ! I am not familiar with pytest, so I'm not sure why this is required. The The tests do work in our CI and if I invoke locally from within the tests subdirectory with Should pytest work with standard library unittests? OOI why use pytest and not tox? |
Sorting in order of importance
I have no idea because I thought they were the same thing: they don't seem to be. So this is probably just me not knowing about python testing and not a bug.
To the question "why not use tox": the tox setup seems a little broken to me as there's no way to run a single test because the default environment runs coverage... I've tried to write a new environment config for that but it becomes a little clunky. Calling "python3 -m unittest" seems fine to me: I just didn't know it
This is only true for one of the classes I think: the others do not invoke the clear functions in |
Actually I think it is a real bug: if you rename TestTimestamp so it isn't the last test unittest runs, your command fails as well |
FYI, you can run python test_repository_tool.py # Runs all test cases (classes) in that module
python test_repository_tool.py TestRepository # Runs all tests (functions) in TestRepository test case
python test_repository_tool.py TestRepository.test_writeall # Runs test_writeall test only Not sure if we can configure tox to allow this fine-grained control, or if that is actually necessary. On my box it would definitely take too long to create a fresh virtual environment and install everything with tox each time I want to run a specific test function. So I usually just run it directly in my dev virtual environment, which uses a recent Python version and has everything installed. I only run tox before I push. |
@jku, do you think it would be helpful to have some of above info in our contributor testing docs? |
They seem obvious in hindsight ...but yes: I was following those instructions and did not figure out how to tweak them to run a single test case. |
Currently TestTimestamp creates custom databases but only clears the default ones. This means next create_*db() call will fail meaning every test after this one will fail (currently TestTimestamp happens to be last but the effect can be seen by renaming it to TestATimestamp). Also remove the clear_*db() calls from TestRepository::Setup(): they are likely to be a workaround for a similar problem earlier (earlier test failed to cleanup). Signed-off-by: Jussi Kukkonen <[email protected]>
f0276ca
to
9db013a
Compare
wrote a better commit message (without the pytest confusion), also removed the superfluous cleanup Joshua noticed -- I think that's probably a workaround of a similar issue earlier in history. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix, the discussion and the cleaned up commit message.
Without this the next create_*db() call will fail meaning
pytest test_repository_tool.py
fails on every test after this one.
Signed-off-by: Jussi Kukkonen [email protected]