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

Pint won't import on Python 2.6 unless the enviornment happens to include unittest2. Should be explicit. #387

movermeyer opened this issue Jun 14, 2016 · 1 comment


Copy link

On Python 2.6 and pint 0.7.2:

>>> import pint
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/exactEarth/pint/env/lib/python2.6/site-packages/pint/", line 19, in <module>
    from .unit import (UnitRegistry, LazyRegistry)
  File "/usr/local/exactEarth/pint/env/lib/python2.6/site-packages/pint/", line 27, in <module>
    from . import registry_helpers
  File "/usr/local/exactEarth/pint/env/lib/python2.6/site-packages/pint/", line 14, in <module>
    from .compat import string_types, zip_longest
  File "/usr/local/exactEarth/pint/env/lib/python2.6/site-packages/pint/compat/", line 58, in <module>
    raise Exception("Testing Pint in Python 2.6 requires package 'unittest2'")
Exception: Testing Pint in Python 2.6 requires package 'unittest2'

Except it shouldn't fail since this dependency is only needed when running tests.

If we add it to the tests_require parameter of

Something like:

tests_require = ['unittest2 ; python_version < '2.7']

and move compatibility lookup into a testsuite/compat/,

then users can import pint on Python 2.6 without having to manually specify additional dependencies in order for it to run.

Pull request coming soon.

movermeyer added a commit to movermeyer/pint that referenced this issue Jun 14, 2016
…ed compatibility information to a testing specific file. Added unittest2 to tests_require for Python 2.6
Copy link

hgrecco commented Nov 17, 2016

Thanks for reporting. Fixed by 842e8f2

@hgrecco hgrecco closed this as completed Nov 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants