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

Closed
movermeyer opened this Issue Jun 14, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@movermeyer

movermeyer commented Jun 14, 2016

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/__init__.py", line 19, in <module>
    from .unit import (UnitRegistry, LazyRegistry)
  File "/usr/local/exactEarth/pint/env/lib/python2.6/site-packages/pint/unit.py", line 27, in <module>
    from . import registry_helpers
  File "/usr/local/exactEarth/pint/env/lib/python2.6/site-packages/pint/registry_helpers.py", line 14, in <module>
    from .compat import string_types, zip_longest
  File "/usr/local/exactEarth/pint/env/lib/python2.6/site-packages/pint/compat/__init__.py", 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 setup.py

Something like:

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

and move compatibility lookup into a testsuite/compat/init.py,

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

A potential fix to hgrecco#387. Changed location of the testing-relat…
…ed compatibility information to a testing specific file. Added unittest2 to tests_require for Python 2.6
@hgrecco

This comment has been minimized.

Owner

hgrecco commented Nov 17, 2016

Thanks for reporting. Fixed by 842e8f2

@hgrecco hgrecco closed this Nov 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment