diff --git a/.travis.yml b/.travis.yml index 62eaa1c8..a30275fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ install: - travis_retry sudo apt-get install -y libnss-db libcurl4-gnutls-dev libgnutls-dev python-ldap python-mox python-pycurl - |- if [[ $TRAVIS_PYTHON_VERSION != '2.7' ]]; then - travis_retry sudo apt-get install -y python3-mox3 python3-ldap + travis_retry sudo apt-get install -y python3-mox3 python3-ldap python3-bsddb3 fi - pip install . - travis_retry pip install -r requirements.txt diff --git a/nss_cache/app_test.py b/nss_cache/app_test.py index 42c42dad..5441ac7d 100644 --- a/nss_cache/app_test.py +++ b/nss_cache/app_test.py @@ -20,9 +20,12 @@ import logging import os -from io import BytesIO as StringIO import sys import unittest +try: + from StringIO import StringIO +except ImportError: + from io import StringIO from nss_cache import app diff --git a/nss_cache/caches/caches_test.py b/nss_cache/caches/caches_test.py index d3b456c4..2a26a209 100644 --- a/nss_cache/caches/caches_test.py +++ b/nss_cache/caches/caches_test.py @@ -27,7 +27,7 @@ try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache import config from nss_cache.caches import caches diff --git a/nss_cache/caches/files_test.py b/nss_cache/caches/files_test.py index 0462f455..c1dff048 100644 --- a/nss_cache/caches/files_test.py +++ b/nss_cache/caches/files_test.py @@ -28,7 +28,7 @@ try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache import config from nss_cache.maps import automount diff --git a/nss_cache/caches/nssdb_test.py b/nss_cache/caches/nssdb_test.py index 89dab2df..f52cad47 100644 --- a/nss_cache/caches/nssdb_test.py +++ b/nss_cache/caches/nssdb_test.py @@ -35,7 +35,7 @@ try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache import error diff --git a/nss_cache/command.py b/nss_cache/command.py index 44afbdab..f6bba032 100644 --- a/nss_cache/command.py +++ b/nss_cache/command.py @@ -24,6 +24,10 @@ import os import shutil from io import BytesIO as StringIO +try: + from StringIO import StringIO +except ImportError: + from io import StringIO import tempfile import time diff --git a/nss_cache/command_test.py b/nss_cache/command_test.py index 17e2c988..8faac2b8 100644 --- a/nss_cache/command_test.py +++ b/nss_cache/command_test.py @@ -23,16 +23,19 @@ import os import pwd import shutil -from io import BytesIO as StringIO import sys import tempfile import time import unittest +try: + from StringIO import StringIO +except ImportError: + from io import StringIO try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache import command from nss_cache import config diff --git a/nss_cache/lock_test.py b/nss_cache/lock_test.py index 0d48c0a0..7b93e972 100644 --- a/nss_cache/lock_test.py +++ b/nss_cache/lock_test.py @@ -34,7 +34,7 @@ try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache import lock diff --git a/nss_cache/nss_test.py b/nss_cache/nss_test.py index 5c0e824a..50f9a0ad 100644 --- a/nss_cache/nss_test.py +++ b/nss_cache/nss_test.py @@ -25,7 +25,7 @@ try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache import config from nss_cache import error diff --git a/nss_cache/sources/consulsource_test.py b/nss_cache/sources/consulsource_test.py index 29b4cc91..20cb56c6 100644 --- a/nss_cache/sources/consulsource_test.py +++ b/nss_cache/sources/consulsource_test.py @@ -2,7 +2,10 @@ __author__ = 'hexedpackets@gmail.com (William Huba)' -from io import BytesIO as StringIO +try: + from StringIO import StringIO +except ImportError: + from io import StringIO import unittest from nss_cache.maps import group diff --git a/nss_cache/sources/httpsource_test.py b/nss_cache/sources/httpsource_test.py index d133c2b1..1299f776 100644 --- a/nss_cache/sources/httpsource_test.py +++ b/nss_cache/sources/httpsource_test.py @@ -25,7 +25,7 @@ try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache import error diff --git a/nss_cache/sources/ldapsource_test.py b/nss_cache/sources/ldapsource_test.py index 1290a046..12f29b26 100644 --- a/nss_cache/sources/ldapsource_test.py +++ b/nss_cache/sources/ldapsource_test.py @@ -26,7 +26,7 @@ try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache import error from nss_cache.maps import automount diff --git a/nss_cache/sources/s3source_test.py b/nss_cache/sources/s3source_test.py index ea7f2ef1..ae9fc472 100644 --- a/nss_cache/sources/s3source_test.py +++ b/nss_cache/sources/s3source_test.py @@ -2,7 +2,10 @@ __author__ = 'alexey.pikin@gmail.com' -from io import BytesIO as StringIO +try: + from StringIO import StringIO +except ImportError: + from io import StringIO import unittest from nss_cache.maps import group diff --git a/nss_cache/update/files_updater_test.py b/nss_cache/update/files_updater_test.py index be55dab1..33b2e64e 100644 --- a/nss_cache/update/files_updater_test.py +++ b/nss_cache/update/files_updater_test.py @@ -30,7 +30,7 @@ try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache import config from nss_cache import error diff --git a/nss_cache/update/map_updater_test.py b/nss_cache/update/map_updater_test.py index d9873339..e8abd4ba 100644 --- a/nss_cache/update/map_updater_test.py +++ b/nss_cache/update/map_updater_test.py @@ -28,7 +28,7 @@ try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache.caches import caches from nss_cache.caches import files diff --git a/nss_cache/update/updater_test.py b/nss_cache/update/updater_test.py index e6589f69..91063844 100644 --- a/nss_cache/update/updater_test.py +++ b/nss_cache/update/updater_test.py @@ -29,7 +29,7 @@ try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache import config from nss_cache.update import updater diff --git a/nss_cache/util/curl.py b/nss_cache/util/curl.py index 18807bb9..ee7f41ac 100644 --- a/nss_cache/util/curl.py +++ b/nss_cache/util/curl.py @@ -22,7 +22,7 @@ try: from cStringIO import StringIO except ImportError: - from io import BytesIO as StringIO + from io import StringIO import logging import pycurl diff --git a/nss_cache/util/timestamps_test.py b/nss_cache/util/timestamps_test.py index 188ec44c..9d11627c 100644 --- a/nss_cache/util/timestamps_test.py +++ b/nss_cache/util/timestamps_test.py @@ -27,7 +27,7 @@ try: import mox except ImportError: - import mox3 + from mox3 import mox from nss_cache.util import timestamps diff --git a/requirements.txt b/requirements.txt index b29800e7..3b1d59fc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,7 @@ pytest boto3==1.7.36 pycurl==7.43.0.2 python-ldap +python3-ldap +python3-mox3 +python3-bsddb3 mox==0.5.3