Changed location of the testing-related requirements
Thanks @movermeyer
This commit is contained in:
@@ -51,15 +51,6 @@ else:
|
||||
|
||||
long_type = long
|
||||
|
||||
if sys.version_info < (2, 7):
|
||||
try:
|
||||
import unittest2 as unittest
|
||||
except ImportError:
|
||||
raise Exception("Testing Pint in Python 2.6 requires package 'unittest2'")
|
||||
else:
|
||||
import unittest
|
||||
|
||||
|
||||
try:
|
||||
from collections import Chainmap
|
||||
except ImportError:
|
||||
|
||||
@@ -9,10 +9,11 @@ import sys
|
||||
|
||||
from contextlib import contextmanager
|
||||
|
||||
from pint.compat import ndarray, unittest, np
|
||||
from pint.compat import ndarray, np
|
||||
|
||||
from pint import logger, UnitRegistry
|
||||
from pint.quantity import _Quantity
|
||||
from pint.testsuite.compat import unittest
|
||||
from pint.testsuite.helpers import PintOutputChecker
|
||||
from logging.handlers import BufferingHandler
|
||||
|
||||
|
||||
9
pint/testsuite/compat/__init__.py
Normal file
9
pint/testsuite/compat/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import sys
|
||||
|
||||
if sys.version_info < (2, 7):
|
||||
try:
|
||||
import unittest2 as unittest
|
||||
except ImportError:
|
||||
raise Exception("Testing Pint in Python 2.6 requires package 'unittest2'")
|
||||
else:
|
||||
import unittest
|
||||
@@ -7,7 +7,8 @@ import doctest
|
||||
from distutils.version import StrictVersion
|
||||
import re
|
||||
|
||||
from pint.compat import unittest, HAS_NUMPY, HAS_UNCERTAINTIES, NUMPY_VER, PYTHON3
|
||||
from pint.compat import HAS_NUMPY, HAS_UNCERTAINTIES, NUMPY_VER, PYTHON3
|
||||
from pint.testsuite.compat import unittest
|
||||
|
||||
|
||||
def requires_numpy18():
|
||||
|
||||
@@ -28,10 +28,7 @@
|
||||
# def test_eval(self, input, expected_output):
|
||||
# self.assertEqual(eval(input), expected_output)
|
||||
|
||||
try:
|
||||
import unittest2 as unittest
|
||||
except ImportError: # pragma: no cover
|
||||
import unittest
|
||||
from pint.testsuite.compat import unittest
|
||||
|
||||
from functools import wraps
|
||||
import collections
|
||||
|
||||
@@ -9,9 +9,10 @@ from pint import UnitRegistry
|
||||
from pint.unit import UnitsContainer
|
||||
from pint.util import ParserHelper
|
||||
|
||||
from pint.compat import np, unittest, long_type
|
||||
from pint.compat import np, long_type
|
||||
from pint.errors import UndefinedUnitError
|
||||
from pint.testsuite import QuantityTestCase, helpers
|
||||
from pint.testsuite.compat import unittest
|
||||
|
||||
|
||||
class TestIssues(QuantityTestCase):
|
||||
|
||||
@@ -8,6 +8,7 @@ import operator as op
|
||||
from pint import DimensionalityError, set_application_registry
|
||||
from pint.compat import np, unittest
|
||||
from pint.testsuite import QuantityTestCase, helpers
|
||||
from pint.testsuite.compat import unittest
|
||||
from pint.testsuite.test_umath import TestUFuncs
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
from __future__ import division, unicode_literals, print_function, absolute_import
|
||||
|
||||
from pint.compat import unittest, tokenizer
|
||||
from pint.compat import tokenizer
|
||||
from pint.pint_eval import build_eval_tree
|
||||
from pint.testsuite.compat import unittest
|
||||
|
||||
|
||||
class TestPintEval(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user