Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: typ/tests/main_test.py

Issue 2201663002: Change typ's interpretation of a test that first fails and is then skipped. (Closed) Base URL: https://github.com/dpranke/typ.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « typ/json_results.py ('k') | typ/version.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: typ/tests/main_test.py
diff --git a/typ/tests/main_test.py b/typ/tests/main_test.py
index f0d027d3836bd3bcf1397cac4424fa9ecf753c56..3823d4155a374fc9c3c8a55f817109d5932b6c94 100644
--- a/typ/tests/main_test.py
+++ b/typ/tests/main_test.py
@@ -374,6 +374,32 @@ class TestCli(test_case.MainTestCase):
'fail_then_pass_test']['FPTest']['test_count']['actual'],
'FAIL PASS')
+ def test_fail_then_skip(self):
+ files = {'fail_then_skip_test.py': d("""\
+ import unittest
+ count = 0
+ class FPTest(unittest.TestCase):
+ def test_count(self):
+ global count
+ count += 1
+ if count == 1:
+ self.fail()
+ elif count == 2:
+ self.skipTest('')
+ """)}
+ _, out, _, files = self.check(['--retry-limit', '3',
+ '--write-full-results-to',
+ 'full_results.json'],
+ files=files, ret=0, err='')
+ self.assertIn('Retrying failed tests (attempt #1 of 3)', out)
+ self.assertNotIn('Retrying failed tests (attempt #2 of 3)', out)
+ self.assertIn('1 test run, 0 failures.\n', out)
+ results = json.loads(files['full_results.json'])
+ self.assertEqual(
+ results['tests'][
+ 'fail_then_skip_test']['FPTest']['test_count']['actual'],
+ 'FAIL SKIP')
+
def test_failures_are_not_elided(self):
_, out, _, _ = self.check(['--terminal-width=20'],
files=FAIL_TEST_FILES, ret=1, err='')
@@ -682,7 +708,7 @@ class TestCli(test_case.MainTestCase):
self.assertEqual(len(posts), 1)
payload = posts[0][2].decode('utf8')
- self.assertIn('"test_pass": {"expected": "PASS", "actual": "PASS"}',
+ self.assertIn('"test_pass": {"actual": "PASS", "expected": "PASS"}',
payload)
self.assertTrue(payload.endswith('--\r\n'))
self.assertNotEqual(server.log.getvalue(), '')
« no previous file with comments | « typ/json_results.py ('k') | typ/version.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698