Sometimes it is useful to run only the first part of a large doctrine file.
There are many situations where the first part breaks after changing the code, I would like to run only the first part until it passes, and then run the entire file again.
I still could not find an easy way to do this.
Let's say I start my teachings with this file:
#!/usr/bin/env python import doctest doctest.testfile("scenario.rst")
And the .rst script looks like this:
>>> 'hello world' 'hello world' >>> exit() >>> 'this should not be processed anymore' ... lots of lines >>> 'this should also not be processed'
In this example, I use the exit () function to demonstrate what I mean, of course, this will not work, because it is considered as an exception, which the doctrine happily sees as part of what it can check:
********************************************************************** File "_scenario.rst", line 10, in _scenario.rst Failed example: exit() Exception raised: Traceback (most recent call last): File "c:\Python27\lib\doctest.py", line 1254, in __run compileflags, 1) in test.globs File "<doctest _scenario.rst[1]>", line 1, in <module> exit() File "c:\Python27\lib\site.py", line 372, in __call__ raise SystemExit(code) SystemExit: None ********************************************************************** File "_scenario.rst", line 12, in _scenario.rst Failed example: 'this should not be processed anymore' Expected nothing Got: 'this should not be processed anymore' ********************************************************************** 1 items had failures: 2 of 3 in _scenario.rst ***Test Failed*** 2 failures.
So, how can you complete such a dossier file in the middle?
EDIT: there is a + SKIP directive, but it skips only one line. I need something that skips the rest of the file.