From 3a28e27ba16a2dedd9617ac2836352dd8b5683ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 10 Oct 2016 18:21:03 +0300 Subject: flake8 tweaks (#27) --- .travis.yml | 2 +- mimeparse_test.py | 13 +++++++++---- setup.py | 2 +- tox.ini | 13 +++++-------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 20935de..f458847 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ env: - TOXENV=py34 - TOXENV=pypy - TOXENV=pypy3 - - TOXENV=pep8,pyflakes + - TOXENV=flake8 # https://github.com/travis-ci/travis-ci/issues/4794 matrix: diff --git a/mimeparse_test.py b/mimeparse_test.py index 6d00238..da39312 100755 --- a/mimeparse_test.py +++ b/mimeparse_test.py @@ -6,9 +6,10 @@ This module loads a json file and converts the tests specified therein to a set of PyUnitTestCases. Then it uses PyUnit to run them and report their status. """ import json -import mimeparse import unittest +import mimeparse + __version__ = "0.1" __author__ = 'Ade Oshineye' @@ -36,15 +37,19 @@ class MimeParseTestCase(unittest.TestCase): def _test_best_match(self, args, expected, description): if expected is None: - self.assertRaises(mimeparse.MimeTypeParseException, mimeparse.best_match, args[0], args[1]) + self.assertRaises(mimeparse.MimeTypeParseException, + mimeparse.best_match, args[0], args[1]) else: result = mimeparse.best_match(args[0], args[1]) - message = "Expected: '%s' but got %s. Description for this test: %s" % (expected, result, description) + message = \ + "Expected: '%s' but got %s. Description for this test: %s" % \ + (expected, result, description) self.assertEqual(expected, result, message) def _test_parse_mime_type(self, args, expected): if expected is None: - self.assertRaises(mimeparse.MimeTypeParseException, mimeparse.parse_mime_type, args) + self.assertRaises(mimeparse.MimeTypeParseException, + mimeparse.parse_mime_type, args) else: expected = tuple(expected) result = mimeparse.parse_mime_type(args) diff --git a/setup.py b/setup.py index e0ba146..cc081a0 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python -import os import codecs +import os import re from setuptools import setup diff --git a/tox.ini b/tox.ini index 62c1338..7977fbe 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py35,py34,py32,py27,pypy,pypy3,pep8,pyflakes +envlist = py35,py34,py32,py27,pypy,pypy3,flake8 [testenv] commands = ./mimeparse_test.py @@ -22,10 +22,7 @@ basepython = pypy [testenv:pypy3] basepython = pypy3 -[testenv:pep8] -deps = pep8 -commands = pep8 --statistics --show-source --ignore=E501 --exclude=.venv,.tox,*egg . - -[testenv:pyflakes] -deps = pyflakes -commands = pyflakes mimeparse.py mimeparse_test.py setup.py +[testenv:flake8] +deps = flake8 + flake8-import-order +commands = flake8 --statistics --show-source --ignore=E501 --exclude=.venv,.tox,*egg . -- cgit v1.2.1