Forcing unit test runner to abort after failed test

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
from django.test import TestCase

class SimpleTest(TestCase):
    ''' Your unit tests go here '''  

    def test_a(self):
        pass
  
  
    def run(self, result=None):
        if result is None: result = self.defaultTestResult()
        try:
            super(SimpleTest, self).run(result)
        except KeyboardInterrupt:
            result.stop()
      

More like this

  1. Super User Conditional Page Exception Reporting by zbyte64 5 years, 8 months ago
  2. Variable._resolve_lookup monkeypatch by showell 4 years, 5 months ago
  3. Capture Stack Trace Decorator by LorenDavie 3 years, 11 months ago
  4. A smart trace() command by aparajita 4 years, 10 months ago
  5. Stop tests at the first failure by akaihola 6 years, 3 months ago

Comments

(Forgotten your password?)