-
Notifications
You must be signed in to change notification settings - Fork 38
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
switch to pytest #25
Comments
Nothing stops JKT users from using |
it occurred to me that we could add pytest as optional dependency and provide one or more functions that target it. e.g. the |
As a standalone package (or as a starting point for c&p work and integration into this package): there is a great cookiecutter package for pytest plugins which per default builds/exports a new fixture. https://github.com/pytest-dev/cookiecutter-pytest-plugin. |
hmm, what are plugins good for? can’t we simply define and use a fixture? or a module-level mark via |
It builds a package which adds all the right things so that you can run Just "defining a fixture" would mean that you have to do that in all projects which use it (or at least import something which is then used as fixture) |
seems easy enough to me, but please tell me more about entry points 😄 |
funnily this popped up on reddit right now: https://www.reddit.com/r/Python/comments/50nqlp/is_nose_still_relevant_how_about_unittest/ |
So right now you cannot use JKT with pytest due to pytest-dev/pytest#1367 |
pytest makes writing tests more fun.
of course targeting unittests at first was an obvious choice, but we should think about if we can switch to something nicer to use.
pytest makes you write top-level functions and assert statements. you don’t need to derive from classes (saving a pointless indentation level) or search for a
assert*
method.IMHO for something like tests, fun is crucial. and with unittest, i quickly lose interest and self-discipline when trying to out again if i want
self.assertSomething
or ratherself.assertOMGDoesThisNameNeverEnd
. also, as i already see in the IRkernel tests, we now have millions of methods on one class instead of splitting the tests nicely into files.the data-driven tests showcased in test_ipykernel.py as well as helper functions can be realized via fixtures.
e.g. we could set up a fixture that retrieves a cached kernel instance and runs its data-driven tests on instantiation:
and then proceed to test:
The text was updated successfully, but these errors were encountered: