summaryrefslogtreecommitdiff
path: root/cloudinit/tests
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2019-03-04 18:21:59 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-03-04 18:21:59 +0000
commitedf052c3196139169ecbfe98049c278f4babc8ca (patch)
treeab2221815bfce6b5f30ff9ee05f0e760c3eb54fb /cloudinit/tests
parenteee0e09ead3d11c32e8888d13d164810ee5f19d6 (diff)
downloadvyos-cloud-init-edf052c3196139169ecbfe98049c278f4babc8ca.tar.gz
vyos-cloud-init-edf052c3196139169ecbfe98049c278f4babc8ca.zip
drop Python 2.6 support and our NIH version detection
- Remove the last few places that use `if PY26` - Replace our Python version detection logic with six's (which we were already using in most places)
Diffstat (limited to 'cloudinit/tests')
-rw-r--r--cloudinit/tests/helpers.py22
1 files changed, 1 insertions, 21 deletions
diff --git a/cloudinit/tests/helpers.py b/cloudinit/tests/helpers.py
index 46a49416..f41180fd 100644
--- a/cloudinit/tests/helpers.py
+++ b/cloudinit/tests/helpers.py
@@ -41,26 +41,6 @@ _real_subp = util.subp
SkipTest = unittest2.SkipTest
skipIf = unittest2.skipIf
-# Used for detecting different python versions
-PY2 = False
-PY26 = False
-PY27 = False
-PY3 = False
-
-_PY_VER = sys.version_info
-_PY_MAJOR, _PY_MINOR, _PY_MICRO = _PY_VER[0:3]
-if (_PY_MAJOR, _PY_MINOR) <= (2, 6):
- if (_PY_MAJOR, _PY_MINOR) == (2, 6):
- PY26 = True
- if (_PY_MAJOR, _PY_MINOR) >= (2, 0):
- PY2 = True
-else:
- if (_PY_MAJOR, _PY_MINOR) == (2, 7):
- PY27 = True
- PY2 = True
- if (_PY_MAJOR, _PY_MINOR) >= (3, 0):
- PY3 = True
-
# Makes the old path start
# with new base instead of whatever
@@ -357,7 +337,7 @@ class FilesystemMockingTestCase(ResourceUsingTestCase):
def patchOpen(self, new_root):
trap_func = retarget_many_wrapper(new_root, 1, open)
- name = 'builtins.open' if PY3 else '__builtin__.open'
+ name = 'builtins.open' if six.PY3 else '__builtin__.open'
self.patched_funcs.enter_context(mock.patch(name, trap_func))
def patchStdoutAndStderr(self, stdout=None, stderr=None):