Hi,
Is it possible to run Python's unittest.main() in Hydrogen? I haven't found any info, so I don't know if it is a bug or a limitation.
The test runs in the IPython shell.
ERROR: /run/user/1000/jupyter/kernel-9871a573-6183-41d6-b478-ee33edba7173 (unittest.loader._FailedTest)
----------------------------------------------------------------------
AttributeError: module '__main__' has no attribute '/run/user/1000/jupyter/kernel-9871a573-6183-41d6-b478-ee33edba7173'
----------------------------------------------------------------------
Ran 1 test in 0.001s
FAILED (errors=1)
An exception has occurred, use %tb to see the full traceback.
SystemExit: True
/usr/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2889: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
Do the tests work inside the jupyter notebook?
Well, it doesn't work in Jupyter when using
if __name__ == '__main__':
unittest.main()
but works with something like
test_suite = unittest.TestSuite()
test_suite.addTest(unittest.makeSuite(TestStringMethods))
runner=unittest.TextTestRunner()
runner.run(test_suite)
So, not a Hydrogen problem, I believe.
This version of the .main call:
if __name__ == '__main__':
unittest.main(argv=['first-arg-is-ignored'], exit=False)
works fine for me. (Source.)
Closing since a solution seems to have been found! :tada:
Most helpful comment
This version of the .main call:
works fine for me. (Source.)