Skip to content

Commit

Permalink
Fix failing test_checkstyle.py by changing Py3 upper limit
Browse files Browse the repository at this point in the history
Now that we by default allow Python 3.6, the former whitelist being tested of allowing Python 3.6 became irrelevant. Instead, we must whitelist an interpreter that we do not allow by default, e.g. Python 3.8.
  • Loading branch information
Eric-Arellano committed Dec 23, 2018
1 parent 37dab44 commit 1134af5
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_lint_runs_for_blanket_whitelist(self):
print(x+7)
"""))
target_py3 = self.make_target('a/python:fail3', PythonLibrary, sources=['fail_py3.py'],
compatibility=['CPython>=3.6'])
compatibility=['CPython>=3.8'])
self.set_options(interpreter_constraints_whitelist=[])
with self.assertRaises(TaskError) as task_error:
self.execute_task(target_roots=[target_py2, target_py3])
Expand All @@ -191,7 +191,7 @@ def test_lint_runs_for_default_constraints_only(self):
print(x+7)
"""))
target_py3 = self.make_target('a/python:fail3', PythonLibrary, sources=['fail_py3.py'],
compatibility=['CPython>=3.6'])
compatibility=['CPython>=3.8'])
with self.assertRaises(TaskError) as task_error:
self.execute_task(target_roots=[target_py2, target_py3])
self.assertIn('4 Python Style issues found', str(task_error.exception))
Expand All @@ -202,7 +202,7 @@ def test_lint_ignores_unwhitelisted_constraints(self):
print(x+7)
"""))
target_py3 = self.make_target('a/python:fail3', PythonLibrary, sources=['fail_py3.py'],
compatibility=['CPython>=3.6'])
compatibility=['CPython>=3.8'])
self.assertEqual(0, self.execute_task(target_roots=[target_py3]))

def test_lint_runs_for_single_whitelisted_constraints(self):
Expand All @@ -211,8 +211,8 @@ def test_lint_runs_for_single_whitelisted_constraints(self):
print(x+7)
"""))
target_py3 = self.make_target('a/python:fail3', PythonLibrary, sources=['fail_py3.py'],
compatibility=['CPython>=3.6'])
self.set_options(interpreter_constraints_whitelist=["CPython>=3.6"])
compatibility=['CPython>=3.8'])
self.set_options(interpreter_constraints_whitelist=["CPython>=3.8"])
with self.assertRaises(TaskError) as task_error:
self.execute_task(target_roots=[target_py3])
self.assertIn('3 Python Style issues found', str(task_error.exception))
Expand All @@ -229,8 +229,8 @@ def test_lint_runs_for_multiple_whitelisted_constraints(self):
print(x+7)
"""))
target_py3 = self.make_target('a/python:fail3', PythonLibrary, sources=['fail_py3.py'],
compatibility=['CPython>=3.6'])
self.set_options(interpreter_constraints_whitelist=["CPython>=2.6", "CPython>=3.6"])
compatibility=['CPython>=3.8'])
self.set_options(interpreter_constraints_whitelist=["CPython>=2.6", "CPython>=3.8"])
with self.assertRaises(TaskError) as task_error:
self.execute_task(target_roots=[target_py2, target_py3])
self.assertIn('7 Python Style issues found', str(task_error.exception))
Expand All @@ -247,8 +247,8 @@ def test_lint_runs_for_default_constraints_and_matching_whitelist(self):
print(x+7)
"""))
target_py3 = self.make_target('a/python:fail3', PythonLibrary, sources=['fail_py3.py'],
compatibility=['CPython>=3.6'])
self.set_options(interpreter_constraints_whitelist=["CPython>=3.6"])
compatibility=['CPython>=3.8'])
self.set_options(interpreter_constraints_whitelist=["CPython>=3.8"])
with self.assertRaises(TaskError) as task_error:
self.execute_task(target_roots=[target_py2, target_py3])
self.assertIn('7 Python Style issues found', str(task_error.exception))

0 comments on commit 1134af5

Please sign in to comment.