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

Unified Diff: third_party/typ/typ/tests/main_test.py

Issue 3017623002: Roll typ to the latest version
Patch Set: Created 3 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 | « third_party/typ/typ/runner.py ('k') | third_party/typ/typ/tests/runner_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/typ/typ/tests/main_test.py
diff --git a/third_party/typ/typ/tests/main_test.py b/third_party/typ/typ/tests/main_test.py
index f17aabc0308edda16db1c0604d2b9bdb7245e9c8..f33d0b3435c82fa72aaf916ad3acb765c2ea6376 100644
--- a/third_party/typ/typ/tests/main_test.py
+++ b/third_party/typ/typ/tests/main_test.py
@@ -354,13 +354,67 @@ class TestCli(test_case.MainTestCase):
files=files, cwd='bar', ret=0, err='',
out='pass_test.PassingTest.test_pass\n')
+ def test_multiple_top_level_dirs(self):
+ files = {
+ 'foo/bar/__init__.py': '',
+ 'foo/bar/pass_test.py': PASS_TEST_PY,
+ 'baz/quux/__init__.py': '',
+ 'baz/quux/second_test.py': PASS_TEST_PY,
+ }
+ self.check(['-l', 'foo/bar', 'baz/quux'], files=files,
+ ret=0, err='',
+ out=(
+ 'bar.pass_test.PassingTest.test_pass\n'
+ 'quux.second_test.PassingTest.test_pass\n'
+ ))
+ self.check(['-l', 'foo/bar/pass_test.py', 'baz/quux'], files=files,
+ ret=0, err='',
+ out=(
+ 'bar.pass_test.PassingTest.test_pass\n'
+ 'quux.second_test.PassingTest.test_pass\n'
+ ))
+ self.check(['-l', '--top-level-dirs', 'foo', '--top-level-dirs', 'baz'],
+ files=files,
+ ret=0, err='',
+ out=(
+ 'bar.pass_test.PassingTest.test_pass\n'
+ 'quux.second_test.PassingTest.test_pass\n'
+ ))
+
+ def test_single_top_level_dir(self):
+ files = {
+ 'foo/bar/__init__.py': '',
+ 'foo/bar/pass_test.py': PASS_TEST_PY,
+ 'baz/quux/__init__.py': '',
+ 'baz/quux/second_test.py': PASS_TEST_PY,
+ }
+ self.check(['-l', '--top-level-dir', 'foo'],
+ files=files,
+ ret=0, err='',
+ out=(
+ 'bar.pass_test.PassingTest.test_pass\n'
+ ))
+
+ def test_can_not_have_both_top_level_flags(self):
+ files = {
+ 'foo/bar/__init__.py': '',
+ 'foo/bar/pass_test.py': PASS_TEST_PY,
+ 'baz/quux/__init__.py': '',
+ 'baz/quux/second_test.py': PASS_TEST_PY,
+ }
+ self.check(
+ ['-l', '--top-level-dir', 'foo', '--top-level-dirs', 'bar'],
+ files=files,
+ ret=1, out='',
+ err='Cannot specify both --top-level-dir and --top-level-dirs\n')
+
def test_help(self):
self.check(['--help'], ret=0, rout='.*', err='')
def test_import_failure_missing_file(self):
_, out, _, _ = self.check(['-l', 'foo'], ret=1, err='')
self.assertIn('Failed to load "foo" in find_tests', out)
- self.assertIn('No module named foo', out)
+ self.assertIn('No module named', out)
def test_import_failure_missing_package(self):
files = {'foo.py': d("""\
@@ -373,7 +427,7 @@ class TestCli(test_case.MainTestCase):
""")}
_, out, _, _ = self.check(['-l', 'foo.py'], files=files, ret=1, err='')
self.assertIn('Failed to load "foo.py" in find_tests', out)
- self.assertIn('No module named package_that_does_not_exist', out)
+ self.assertIn('No module named', out)
def test_import_failure_no_tests(self):
files = {'foo.py': 'import unittest'}
« no previous file with comments | « third_party/typ/typ/runner.py ('k') | third_party/typ/typ/tests/runner_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698