diff options
author | Roman Haritonov <reclosedev@gmail.com> | 2014-12-06 11:20:08 +0300 |
---|---|---|
committer | Roman Haritonov <reclosedev@gmail.com> | 2014-12-06 11:20:08 +0300 |
commit | 1f329b314625af5589d1dc8043c7d7f593e02529 (patch) | |
tree | 44af84d398cb3e5d81fe28e7b1045cedb14eca4d | |
parent | bfca3909630fb85a5655797a701059098bb8b36a (diff) | |
download | requests-cache-1f329b314625af5589d1dc8043c7d7f593e02529.tar.gz |
Trying to make tests compatible with Python 2.6
-rw-r--r-- | requirements-test.txt | 1 | ||||
-rw-r--r-- | tests/test_cache.py | 6 | ||||
-rw-r--r-- | tests/test_dbdict.py | 6 | ||||
-rw-r--r-- | tests/test_mongodict.py | 6 | ||||
-rw-r--r-- | tests/test_monkey_patch.py | 5 | ||||
-rw-r--r-- | tests/test_redisdict.py | 5 | ||||
-rw-r--r-- | tests/test_thread_safety.py | 8 |
7 files changed, 29 insertions, 8 deletions
diff --git a/requirements-test.txt b/requirements-test.txt index 1ac0a5d..981e473 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,5 @@ pytest +unittest2 pymongo redis requests diff --git a/tests/test_cache.py b/tests/test_cache.py index 68fd0f5..aa7d462 100644 --- a/tests/test_cache.py +++ b/tests/test_cache.py @@ -4,7 +4,11 @@ import os, sys sys.path.insert(0, os.path.abspath('..')) -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest + import time import json from collections import defaultdict diff --git a/tests/test_dbdict.py b/tests/test_dbdict.py index ebd0498..04987ee 100644 --- a/tests/test_dbdict.py +++ b/tests/test_dbdict.py @@ -4,8 +4,12 @@ import os, sys sys.path.insert(0, os.path.abspath('..')) +try: + import unittest2 as unittest +except ImportError: + import unittest + from threading import Thread -import unittest from tests.test_custom_dict import BaseCustomDictTestCase from requests_cache.backends.storage.dbdict import DbDict, DbPickleDict diff --git a/tests/test_mongodict.py b/tests/test_mongodict.py index 3dfc056..bd7f49e 100644 --- a/tests/test_mongodict.py +++ b/tests/test_mongodict.py @@ -4,7 +4,11 @@ import os, sys sys.path.insert(0, os.path.abspath('..')) -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest + from tests.test_custom_dict import BaseCustomDictTestCase try: from requests_cache.backends.storage.mongodict import MongoDict, MongoPickleDict diff --git a/tests/test_monkey_patch.py b/tests/test_monkey_patch.py index 21e62b9..f944014 100644 --- a/tests/test_monkey_patch.py +++ b/tests/test_monkey_patch.py @@ -4,7 +4,10 @@ import os, sys sys.path.insert(0, os.path.abspath('..')) -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import requests from requests.sessions import Session as OriginalSession diff --git a/tests/test_redisdict.py b/tests/test_redisdict.py index d63caf0..6dce788 100644 --- a/tests/test_redisdict.py +++ b/tests/test_redisdict.py @@ -4,7 +4,10 @@ import os, sys sys.path.insert(0, os.path.abspath('..')) -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest from tests.test_custom_dict import BaseCustomDictTestCase try: diff --git a/tests/test_thread_safety.py b/tests/test_thread_safety.py index 83a9742..3b90e67 100644 --- a/tests/test_thread_safety.py +++ b/tests/test_thread_safety.py @@ -4,10 +4,12 @@ import os, sys sys.path.insert(0, os.path.abspath('..')) -from threading import Thread -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest -import requests +from threading import Thread from requests_cache import CachedSession CACHE_NAME = 'requests_cache_test' |