Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(mimeparse): Test for the correct version of mimeparse #871

Merged
merged 1 commit into from
Aug 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ Features
- CPython 2.6-2.7, PyPy, Jython 2.7, and CPython 3.3-3.5 support
- ~20% speed boost when Cython is available

Install
-------
Installation
------------

PyPy
^^^^
Expand Down Expand Up @@ -122,8 +122,19 @@ these issues by setting additional Clang C compiler flags as follows:

$ export CFLAGS="-Qunused-arguments -Wno-unused-function"

Test
----

Dependencies
------------

Falcon depends on six and `python-mimeparse`. `python-mimeparse` is a
better-maintained fork of the similarly named `mimeparse` project.
Normally the correct package will be selected by Falcon's ``setup.py``.
However, if you are using an alternate strategy to manage dependencies,
please take care to install the correct package in order to avoid
errors.

Tests
-----

.. code:: bash

Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
VERSION = imp.load_source('version', path.join('.', 'falcon', 'version.py'))
VERSION = VERSION.__version__

# NOTE(kgriffs): python-mimeparse is newer than mimeparse, supports Py3
# TODO(kgriffs): Fork and optimize/modernize python-mimeparse
REQUIRES = ['six>=1.4.0', 'python-mimeparse']
# NOTE(kgriffs): python-mimeparse is better-maintained fork of mimeparse
REQUIRES = ['six>=1.4.0', 'python-mimeparse>=1.5.2']

JYTHON = 'java' in sys.platform

Expand Down
18 changes: 18 additions & 0 deletions tests/test_deps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import mimeparse
import testtools


class TestDeps(testtools.TestCase):

def test_mimeparse_correct_package(self):
"""Ensure we are dealing with python-mimeparse, not mimeparse."""

tokens = mimeparse.__version__.split('.')
msg = ('Incorrect dependency detected. Please install the '
'"python-mimeparse" package instead of the "mimeparse" '
'package.')

# NOTE(kgriffs): python-mimeparse starts at version 1.5.2,
# whereas the mimeparse package is at version 0.1.4 at the time
# of this writing.
self.assertGreater(int(tokens[0]), 0, msg)