Skip to content

Commit

Permalink
Disallow failure of Python 2.6 builds again
Browse files Browse the repository at this point in the history
The Python 2.6 build was allowed to fail, because it couldn't detect format
strings which use implicit parameters. It cannot just ignore P101-P103 results
as it'll also detect unused parameters (as P301) because it didn't detect that
it would be used on Python 2.7 and up.

So it just skips the tests which would usually fail.
  • Loading branch information
xZise committed Jul 27, 2016
1 parent cc2c09b commit 2fc3645
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 0 additions & 5 deletions .travis.yml
Expand Up @@ -12,11 +12,6 @@ script:
- python setup.py test
- if [[ "$TRAVIS_PYTHON_VERSION" != "nightly" ]]; then coverage run setup.py test ; fi

matrix:
allow_failures:
# Allow failures on 2.6 as it doesn't detect implicit parameters
- python: "2.6"

notifications:
email: false
before_install:
Expand Down
6 changes: 5 additions & 1 deletion test_flake8_string_format.py
Expand Up @@ -9,7 +9,9 @@
import sys
import tempfile

if sys.version_info < (2, 7):
PY26 = sys.version_info[:2] == (2, 6)

if PY26:
import unittest2 as unittest
else:
import unittest
Expand Down Expand Up @@ -107,6 +109,7 @@ def run_code(self, code, positions, filename):
checker = flake8_string_format.StringFormatChecker(tree, filename)
self.run_test_pos(positions, self.create_iterator(checker))

@unittest.skipIf(PY26, 'Python 2.6 does not handle implicit parameters.')
def test_checker(self):
self.run_code(dynamic_code, dynamic_positions, 'fn')

Expand Down Expand Up @@ -218,6 +221,7 @@ def run_test(self, ignored='', is_ignored=lambda n: False):
flake8_string_format.main(parameters + [self.tmp_file])
self.run_test_pos(positions, self.iterator())

@unittest.skipIf(PY26, 'Python 2.6 does not handle implicit parameters.')
def test_main(self):
code = '#!/usr/bin/python\n# -*- coding: utf-8 -*-\n' + dynamic_code
self.tmp_file = tempfile.mkstemp()[1]
Expand Down

0 comments on commit 2fc3645

Please sign in to comment.