Using doctest
If you wish to use doctest, then treat it just as Python IDLE (see doctest documentation for tips on how to prepare tests), assign results of the previous tests to some variables and then use conditional checks for determining whether you wish to execute other tests. Just like that.
Unfortunately it has nothing to do with unittest.
Using unittest
Command-line options for unittest
When it comes to unittest, you can still invoke it from command line using -f (--failfast) option, so it stops test run on the first error or failure.
Skipping tests
unittest supports skipping tests based on some conditions (see documentation) or when you know the test is broken and you do not want to count it as failure. See basic skipping example:
class MyTestCase(unittest.TestCase):
    @unittest.skip("demonstrating skipping")
    def test_nothing(self):
        self.fail("shouldn't happen")
    @unittest.skipIf(mylib.__version__ < (1, 3),
                     "not supported in this library version")
    def test_format(self):
        # Tests that work for only a certain version of the library.
        pass
    @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
    def test_windows_support(self):
        # windows specific testing code
        pass
Was it helpful?
     
    
doctesttests, if you would like to know.unittestyou may be looking for. You did not mention the module you use for unit testing, so I assumedunittest.