diff options
| author | John Carter <john@therefromhere.org> | 2019-01-19 14:11:28 +1300 |
|---|---|---|
| committer | John Carter <john@therefromhere.org> | 2019-01-19 14:11:28 +1300 |
| commit | cdaf2c628a0b2bca5f808f13eb2fd150c508ca6b (patch) | |
| tree | dbcc58797b6feb15bea7966ac36fefa7dc3f7a90 /tests | |
| parent | 9f3193da7408cec9ac9c612e047d1c48ba9e542c (diff) | |
| download | webtest-cdaf2c628a0b2bca5f808f13eb2fd150c508ca6b.tar.gz | |
Converted lint check_* functions to raise AssertionError instead of assert
So they still check when PYTHONOPTIMIZE>=1
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_lint.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/test_lint.py b/tests/test_lint.py index e0b7f31..1472edf 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -43,7 +43,6 @@ def application(environ, start_response): return resp(environ, start_response) -@unittest.skipIf(sys.flags.optimize > 0, "skip assert tests if optimize is enabled") class TestLatin1Assertion(unittest.TestCase): def test_valid_type(self): @@ -66,9 +65,9 @@ class TestToString(unittest.TestCase): self.assertEqual(to_string(b'foo'), 'foo') -@unittest.skipIf(sys.flags.optimize > 0, "skip assert tests if optimize is enabled") class TestMiddleware(unittest.TestCase): + @unittest.skipIf(sys.flags.optimize > 0, "skip assert tests if optimize is enabled") def test_lint_too_few_args(self): linter = middleware(application) with self.assertRaisesRegexp(AssertionError, "Two arguments required"): @@ -76,6 +75,7 @@ class TestMiddleware(unittest.TestCase): with self.assertRaisesRegexp(AssertionError, "Two arguments required"): linter({}) + @unittest.skipIf(sys.flags.optimize > 0, "skip assert tests if optimize is enabled") def test_lint_no_keyword_args(self): linter = middleware(application) with self.assertRaisesRegexp(AssertionError, "No keyword arguments " @@ -144,7 +144,6 @@ class TestMiddleware2(unittest.TestCase): # don't know what to assert here... a bit cheating, just covers code -@unittest.skipIf(sys.flags.optimize > 0, "skip assert tests if optimize is enabled") class TestCheckContentType(unittest.TestCase): def test_no_content(self): status = "204 No Content" @@ -162,7 +161,6 @@ class TestCheckContentType(unittest.TestCase): self.assertRaises(AssertionError, check_content_type, status, headers) -@unittest.skipIf(sys.flags.optimize > 0, "skip assert tests if optimize is enabled") class TestCheckHeaders(unittest.TestCase): @unittest.skipIf(PY3, 'unicode is str in Python3') |
