I was testing some changes in a test in openwisp_monitoring and thought of using a docstring to better explain a test.
That's when I noticed TimeLoggingTestRunner doesn't work with docstrings, due to one particular line. Below is the traceback, it can be easily reproduced by introducing a docstring in any slow test.
Traceback (most recent call last):
File "tests/test_project/tests/test_test_utils.py", line 51, in test_time_logging_runner
runner.run_suite(suite)
File "/home/hardik/.local/lib/python3.6/site-packages/django/test/runner.py", line 630, in run_suite
return runner.run(suite)
File "/usr/lib/python3.6/unittest/runner.py", line 180, in run
stopTestRun()
File "/home/hardik/openwisp/openwisp-utils/openwisp_utils/tests.py", line 66, in stopTestRun
self.display_slow_tests()
File "/home/hardik/openwisp/openwisp-utils/openwisp_utils/tests.py", line 51, in display_slow_tests
name, module = name.split()
ValueError: too many values to unpack (expected 2)
Though I haven't seen much usage of docstring in tests in openwisp, still there shouldn't be a limitation, in my opinion. I will try to fix this and submit a patch.
I was testing some changes in a test in
openwisp_monitoring
and thought of using a docstring to better explain a test. That's when I noticedTimeLoggingTestRunner
doesn't work withdocstrings
, due to one particular line. Below is the traceback, it can be easily reproduced by introducing a docstring in any slow test.Though I haven't seen much usage of docstring in tests in
openwisp
, still there shouldn't be a limitation, in my opinion. I will try to fix this and submit a patch.