cmd2: failed to test my transcripts
As I made major changes in my app, I am removing unittests to just rely on transcript-based testing.
I have generated a transcript following https://cmd2.readthedocs.io/en/latest/freefeatures.html#transcript-based-testing then I run my script https://github.com/teto/mptcpanalyzer/blob/new_plots/tests/run_transcripts.sh (I used the absolute path to rule out any relative path problem).
$ tests/run_transcripts.sh
WARNING: mptcpanalyzer may require a custom wireshark. Check github for mptcp patches streaming.
E
======================================================================
ERROR: runTest (cmd2.cmd2.Cmd.run_transcript_tests.<locals>.TestMyAppCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/nix/store/1ajhfmk8kcdc3jm5f6nivsarj0dbaw63-python3.6-cmd2-0.9.4/lib/python3.6/site-packages/cmd2/transcript.py", line 53, in runTest
self._test_transcript(fname, transcript)
File "/nix/store/1ajhfmk8kcdc3jm5f6nivsarj0dbaw63-python3.6-cmd2-0.9.4/lib/python3.6/site-packages/cmd2/transcript.py", line 70, in _test_transcript
line = next(transcript)
StopIteration
----------------------------------------------------------------------
Ran 1 test in 0.001s
I am on
Python 3.6.6 (default, Jun 27 2018, 05:47:41)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cmd2
>>> cmd2.__version__
'0.9.4'
As a note to myself, it’s not crystal clear how to run a shellscript instead of unittest in pip setup.py test
but I found the trick !:
cmdclass={
"test": RunTests,
# 'publish':
},
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (10 by maintainers)
@kotfu I looked into this issue a little more. The transcript testing error only occurs when the last command in the transcript has no output.