diff options
author | Barry Warsaw <barry@python.org> | 2015-01-26 11:14:06 -0500 |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2015-01-26 11:14:06 -0500 |
commit | 841db73600e3f203243c773109d71ab88d3334bc (patch) | |
tree | 051f44833ae1ec1b31c5f893c6eca8b39e07a83c /tests/unittests/helpers.py | |
parent | 3246c85763d5cdebb3e240fcd5ae29834cbf6299 (diff) | |
download | vyos-cloud-init-841db73600e3f203243c773109d71ab88d3334bc.tar.gz vyos-cloud-init-841db73600e3f203243c773109d71ab88d3334bc.zip |
More test repairs.
Diffstat (limited to 'tests/unittests/helpers.py')
-rw-r--r-- | tests/unittests/helpers.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py index 70b8116f..4b8dcc5c 100644 --- a/tests/unittests/helpers.py +++ b/tests/unittests/helpers.py @@ -1,8 +1,11 @@ import os import sys +import shutil import tempfile import unittest +import six + try: from unittest import mock except ImportError: @@ -15,8 +18,6 @@ except ImportError: from cloudinit import helpers as ch from cloudinit import util -import shutil - # Used for detecting different python versions PY2 = False PY26 = False @@ -115,7 +116,12 @@ def retarget_many_wrapper(new_base, am, old_func): nam = len(n_args) for i in range(0, nam): path = args[i] - n_args[i] = rebase_path(path, new_base) + # patchOS() wraps various os and os.path functions, however in + # Python 3 some of these now accept file-descriptors (integers). + # That breaks rebase_path() so in lieu of a better solution, just + # don't rebase if we get a fd. + if isinstance(path, six.string_types): + n_args[i] = rebase_path(path, new_base) return old_func(*n_args, **kwds) return wrapper |