KernelTests doesn't play well with py.test tests discovery
kmike opened this issue · 3 comments
kmike commented
py.test runs all unittest.TestCase subclasses found, so if you write
class MyKernelTests(KernelTests):
# ....
then both tests for your kernel and tests defined in a base class are executed; as base class is not set up half of tests fail.
I'm using this trick to fix it:
# hack to avoid running base KernelTests
class Base(object):
from jupyter_kernel_test import KernelTests
class MyKernelTest(Base.KernelTests):
# ...
Do you think there is a better solution? If not, maybe it worths documenting?
kmike commented
Ouch, the example in README works, sorry for noise :)
The trick is not to import KernelTests directly, but use jupyter_kernel_test.KernelTests
.
martinRenou commented
Actually I think this issue should be addressed. It's a backward incompatible change, but not too difficult to fix.
takluyver commented
We can do it without incompatibility; just have an alias for the old name.