Skip to content

Commit

Permalink
Add a test that six was imported.
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed May 21, 2015
1 parent a9a94a3 commit e205a91
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/iris/tests/test_coding_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ class TestFutureImports(unittest.TestCase):
r"print_function(,\s*unicode_literals)?\)$",
flags=re.MULTILINE)

six_import_pattern = re.compile(
r"^import six$",
flags=re.MULTILINE)

def test_future_imports(self):
# Tests that every single Python file includes the appropriate
# __future__ import to enforce consistent behaviour.
Expand Down Expand Up @@ -408,6 +412,12 @@ def test_future_imports(self):
'test.'.format(full_fname))
failed = True

if re.search(self.six_import_pattern, content) is None:
print('The file {} has no valid six import '
'and has not been excluded from the imports '
'test.'.format(full_fname))
failed = True

if failed:
raise ValueError('There were __future__ import check failures. '
'See stdout.')
Expand Down

0 comments on commit e205a91

Please sign in to comment.