Skip to content

Commit

Permalink
flake8 tweaks (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
scop authored and wojcikstefan committed Oct 10, 2016
1 parent 17556a5 commit 3a28e27
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -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:
Expand Down
13 changes: 9 additions & 4 deletions mimeparse_test.py
Expand Up @@ -6,9 +6,10 @@
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'
Expand Down Expand Up @@ -36,15 +37,19 @@ def _test_quality(self, args, expected):

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)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python

import os
import codecs
import os
import re
from setuptools import setup

Expand Down
13 changes: 5 additions & 8 deletions 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
Expand All @@ -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 .

0 comments on commit 3a28e27

Please sign in to comment.