diff options
| author | Seth M Morton <seth.m.morton@gmail.com> | 2015-06-22 22:54:52 -0700 |
|---|---|---|
| committer | Seth M Morton <seth.m.morton@gmail.com> | 2015-06-22 22:54:52 -0700 |
| commit | 67645d06102b78930dddb93eb9e6cffdbf3c8cb5 (patch) | |
| tree | 31e28140ba510e404b0629b6ff28a4288e8873db | |
| parent | fcda77ac5c7ea79dbdecacdca38e873c2898beda (diff) | |
| download | natsort-67645d06102b78930dddb93eb9e6cffdbf3c8cb5.tar.gz | |
Moved py26.py to test_natsort folder.
This file imports both hypothesis and mock, which should only be
dependencies for testing.
| -rw-r--r-- | test_natsort/compat/__init__.py | 0 | ||||
| -rw-r--r-- | test_natsort/compat/py26.py (renamed from natsort/compat/py26.py) | 7 | ||||
| -rw-r--r-- | test_natsort/test_fake_fastnumbers.py | 2 | ||||
| -rw-r--r-- | test_natsort/test_locale_help.py | 2 | ||||
| -rw-r--r-- | test_natsort/test_main.py | 2 | ||||
| -rw-r--r-- | test_natsort/test_utils.py | 2 |
6 files changed, 10 insertions, 5 deletions
diff --git a/test_natsort/compat/__init__.py b/test_natsort/compat/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test_natsort/compat/__init__.py diff --git a/natsort/compat/py26.py b/test_natsort/compat/py26.py index 064860f..15991e1 100644 --- a/natsort/compat/py26.py +++ b/test_natsort/compat/py26.py @@ -1,8 +1,12 @@ -import mock import sys +try: + import unittest.mock as mock +except ImportError: + import mock major_minor = sys.version_info[:2] +# Use hypothesis if not on python 2.6. if major_minor != (2, 6): use_hypothesis = True from hypothesis import assume, given, example @@ -11,6 +15,7 @@ if major_minor != (2, 6): integers_from, sampled_from, ) +# Otherwise mock these imports. else: example = integers_in_range = integers_from = \ sampled_from = assume = given = mock.MagicMock() diff --git a/test_natsort/test_fake_fastnumbers.py b/test_natsort/test_fake_fastnumbers.py index 2e1f424..560b7c3 100644 --- a/test_natsort/test_fake_fastnumbers.py +++ b/test_natsort/test_fake_fastnumbers.py @@ -9,7 +9,7 @@ import unicodedata from math import isnan from natsort.fake_fastnumbers import fast_float, fast_int, isfloat, isint from natsort.compat.py23 import py23_str -from natsort.compat.py26 import assume, given, use_hypothesis +from compat.py26 import assume, given, use_hypothesis def is_float(x): diff --git a/test_natsort/test_locale_help.py b/test_natsort/test_locale_help.py index ae807e2..9a536be 100644 --- a/test_natsort/test_locale_help.py +++ b/test_natsort/test_locale_help.py @@ -12,7 +12,7 @@ from natsort.fake_fastnumbers import fast_float, isfloat from natsort.locale_help import grouper, locale_convert, use_pyicu from natsort.compat.locale import load_locale, has_locale_de_DE from natsort.compat.py23 import py23_str -from natsort.compat.py26 import assume, given, use_hypothesis +from compat.py26 import assume, given, use_hypothesis if use_pyicu: from natsort.locale_help import get_pyicu_transform diff --git a/test_natsort/test_main.py b/test_natsort/test_main.py index b2337bc..a23a48e 100644 --- a/test_natsort/test_main.py +++ b/test_natsort/test_main.py @@ -7,7 +7,7 @@ import pytest import re import sys from pytest import raises -from natsort.compat.py26 import ( +from compat.py26 import ( assume, given, integers_from, diff --git a/test_natsort/test_utils.py b/test_natsort/test_utils.py index 09bc098..a2a0565 100644 --- a/test_natsort/test_utils.py +++ b/test_natsort/test_utils.py @@ -21,7 +21,7 @@ from natsort.compat.py23 import py23_str from slow_splitters import int_splitter, float_splitter, sep_inserter -from natsort.compat.py26 import ( +from compat.py26 import ( assume, given, example, |
