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

Unified Diff: typ/tests/main_test.py

Issue 2363773008: Add better logging when failing to load a test. (Closed)
Patch Set: patch for review Created 4 years, 3 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/runner.py ('k') | typ/tests/runner_test.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 75fb3354b096ccfbe7fe8e4a5067dbe40fdd4d77..bec1c554b81af27e1c2133c2ffada5d3dac06a0d 100644
--- a/typ/tests/main_test.py
+++ b/typ/tests/main_test.py
@@ -358,8 +358,8 @@ class TestCli(test_case.MainTestCase):
self.check(['--help'], ret=0, rout='.*', err='')
def test_import_failure_missing_file(self):
- self.check(['-l', 'foo'], ret=1, err='',
- rout='Failed to load "foo".*')
+ _, out, _, _ = self.check(['-l', 'foo'], ret=1, err='')
+ self.assertIn('Failed to load "foo" in find_tests', out)
nednguyen 2016/09/24 01:51:45 Can you assert the out message contains the except
Dirk Pranke 2016/10/11 23:48:33 Done.
def test_import_failure_missing_package(self):
files = {'foo.py': d("""\
@@ -370,13 +370,13 @@ class TestCli(test_case.MainTestCase):
def test_case(self):
pass
""")}
- self.check(['-l', 'foo.py'], files=files, ret=1, err='',
- rout=('Failed to load "foo.py":'))
+ _, out, _, _ = self.check(['-l', 'foo.py'], files=files, ret=1, err='')
+ self.assertIn('Failed to load "foo.py" in find_tests', out)
nednguyen 2016/09/24 01:51:45 ditto
Dirk Pranke 2016/10/11 23:48:33 Done.
def test_import_failure_no_tests(self):
files = {'foo.py': 'import unittest'}
- self.check(['-l', 'foo.bar'], files=files, ret=1, err='',
- rout='Failed to load "foo.bar":.*')
+ _, out, _, _ = self.check(['-l', 'foo.bar'], files=files, ret=1, err='')
+ self.assertIn('Failed to load "foo.bar" in find_tests', out)
Dirk Pranke 2016/10/11 23:48:33 I'm not actually sure what I thought I was testing
def test_import_failure_syntax_error(self):
files = {'syn_test.py': d("""\
« no previous file with comments | « typ/runner.py ('k') | typ/tests/runner_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698