diff options
| author | Scott Moser <smoser@ubuntu.com> | 2015-02-10 20:53:20 -0500 | 
|---|---|---|
| committer | Scott Moser <smoser@ubuntu.com> | 2015-02-10 20:53:20 -0500 | 
| commit | cd632b2f153a61faa48531cb41d0288650e72c71 (patch) | |
| tree | a3a35b9ca437d999a15fdd25c0a0de88e3cafafb /tests/unittests/test_handler/test_handler_yum_add_repo.py | |
| parent | 78915c97c18d678db10e0fde0d9306823c5f4610 (diff) | |
| parent | f5f280cae778bd214b91664f28d9eed997fbcda5 (diff) | |
| download | vyos-cloud-init-cd632b2f153a61faa48531cb41d0288650e72c71.tar.gz vyos-cloud-init-cd632b2f153a61faa48531cb41d0288650e72c71.zip | |
python3 support.
This gives us functional python3 support.  There are likely
still bugs, but instance boot on openstack is functional now.
LP: #1247132
Diffstat (limited to 'tests/unittests/test_handler/test_handler_yum_add_repo.py')
| -rw-r--r-- | tests/unittests/test_handler/test_handler_yum_add_repo.py | 12 | 
1 files changed, 8 insertions, 4 deletions
| diff --git a/tests/unittests/test_handler/test_handler_yum_add_repo.py b/tests/unittests/test_handler/test_handler_yum_add_repo.py index 435c9787..3a8aa7c1 100644 --- a/tests/unittests/test_handler/test_handler_yum_add_repo.py +++ b/tests/unittests/test_handler/test_handler_yum_add_repo.py @@ -4,9 +4,11 @@ from cloudinit.config import cc_yum_add_repo  from .. import helpers +import shutil +import tempfile  import logging -from StringIO import StringIO +from six import BytesIO  import configobj @@ -16,7 +18,8 @@ LOG = logging.getLogger(__name__)  class TestConfig(helpers.FilesystemMockingTestCase):      def setUp(self):          super(TestConfig, self).setUp() -        self.tmp = self.makeDir(prefix="unittest_") +        self.tmp = tempfile.mkdtemp() +        self.addCleanup(shutil.rmtree, self.tmp)      def test_bad_config(self):          cfg = { @@ -52,8 +55,9 @@ class TestConfig(helpers.FilesystemMockingTestCase):          }          self.patchUtils(self.tmp)          cc_yum_add_repo.handle('yum_add_repo', cfg, None, LOG, []) -        contents = util.load_file("/etc/yum.repos.d/epel_testing.repo") -        contents = configobj.ConfigObj(StringIO(contents)) +        contents = util.load_file("/etc/yum.repos.d/epel_testing.repo", +                                  decode=False) +        contents = configobj.ConfigObj(BytesIO(contents))          expected = {              'epel_testing': {                  'name': 'Extra Packages for Enterprise Linux 5 - Testing', | 
