From 065651b4fe89b0893d4ef4e2d4343eec67d2f65f Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sat, 4 Mar 2017 23:01:50 -0800 Subject: [PATCH] coverage: Exclude uncovered lines in test_signup. --- tools/coveragerc | 4 +++- tools/test-backend | 1 - zerver/tests/test_signup.py | 10 +++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/coveragerc b/tools/coveragerc index 4d272b0dba..c8e40dfcaa 100644 --- a/tools/coveragerc +++ b/tools/coveragerc @@ -2,11 +2,13 @@ # Regexes for lines to exclude from consideration exclude_lines = # Re-enable the standard coverage pragma - pragma: no cover + nocoverage # Don't complain if non-runnable code isn't run: if False: # Don't require coverage for base class NotImplementedErrors raise NotImplementedError() + # Don't require coverage for test suite AssertionError -- they're usually for clarity + raise AssertionError # Don't require coverage for Python 2/3 variations; it's impossible to cover on both if six.PY3: if six.PY2: diff --git a/tools/test-backend b/tools/test-backend index 1a2d2fca05..531795c742 100755 --- a/tools/test-backend +++ b/tools/test-backend @@ -88,7 +88,6 @@ not_yet_fully_covered = { 'zerver/tests/test_email_mirror.py', 'zerver/tests/test_events.py', 'zerver/tests/test_narrow.py', - 'zerver/tests/test_signup.py', 'zerver/tests/test_subs.py', 'zerver/tests/test_templates.py', 'zerver/tests/test_tornado.py', diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.py index f5350f0adb..dcd9f1e00a 100644 --- a/zerver/tests/test_signup.py +++ b/zerver/tests/test_signup.py @@ -98,7 +98,7 @@ class PublicURLTest(ZulipTestCase): # 'index.md') to `get_urls['200']` list. for doc in os.listdir('./templates/zerver/help'): if doc.startswith(".") or '~' in doc or '#' in doc: - continue + continue # nocoverage -- just here for convenience if doc not in {'main.html', 'index.md', 'include'}: get_urls[200].append('/help/' + os.path.splitext(doc)[0]) # Strip the extension. @@ -1059,7 +1059,7 @@ class UserSignUpTest(ZulipTestCase): message.body).groups()[0] break else: - raise ValueError("Couldn't find a confirmation email.") + raise AssertionError("Couldn't find a confirmation email.") result = self.client_get(confirmation_url) self.assertEqual(result.status_code, 200) @@ -1100,7 +1100,7 @@ class UserSignUpTest(ZulipTestCase): message.body).groups()[0] break else: - raise ValueError("Couldn't find a confirmation email.") + raise AssertionError("Couldn't find a confirmation email.") result = self.client_get(confirmation_url) self.assertEqual(result.status_code, 200) @@ -1179,7 +1179,7 @@ class UserSignUpTest(ZulipTestCase): message.body).groups()[0] break else: - raise ValueError("Couldn't find a confirmation email.") + raise AssertionError("Couldn't find a confirmation email.") with self.settings( POPULATE_PROFILE_VIA_LDAP=True, @@ -1253,7 +1253,7 @@ class UserSignUpTest(ZulipTestCase): message.body).groups()[0] break else: - raise ValueError("Couldn't find a confirmation email.") + raise AssertionError("Couldn't find a confirmation email.") result = self.client_get(confirmation_url) self.assertEqual(result.status_code, 200)