def test_run_locals(self): stdout = self.useFixture(fixtures.StringStream('stdout')) class Failing(TestCase): def test_a(self): a = 1 self.fail('a') runner = run.TestToolsTestRunner(tb_locals=True, stdout=stdout.stream) runner.run(Failing('test_a')) self.assertThat( stdout.getDetails()['stdout'].as_text(), Contains('a = 1'))
def test_run_failfast(self): stdout = self.useFixture(fixtures.StringStream('stdout')) class Failing(TestCase): def test_a(self): self.fail('a') def test_b(self): self.fail('b') with fixtures.MonkeyPatch('sys.stdout', stdout.stream): runner = run.TestToolsTestRunner(failfast=True) runner.run(TestSuite([Failing('test_a'), Failing('test_b')])) self.assertThat( stdout.getDetails()['stdout'].as_text(), Contains('Ran 1 test'))