From e9292fc942b6ff219cf8fa2bd5a80bb5a2c273f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 22 Feb 2016 15:58:34 +0100 Subject: [PATCH] [tests] Dummy compose is no longer private MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lubomír Sedlář --- tests/helpers.py | 2 +- tests/test_buildinstall.py | 4 ++-- tests/test_imagebuildphase.py | 20 ++++++++++---------- tests/test_imagechecksumphase.py | 12 ++++++------ tests/test_liveimagesphase.py | 20 ++++++++++---------- tests/test_livemediaphase.py | 16 ++++++++-------- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 12c97e8f..a8bc8f9d 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -17,7 +17,7 @@ class PungiTestCase(unittest.TestCase): shutil.rmtree(self.topdir) -class _DummyCompose(object): +class DummyCompose(object): def __init__(self, topdir, config): self.supported = True self.compose_date = '20151203' diff --git a/tests/test_buildinstall.py b/tests/test_buildinstall.py index 29ea9a57..756971f1 100755 --- a/tests/test_buildinstall.py +++ b/tests/test_buildinstall.py @@ -11,10 +11,10 @@ import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.phases.buildinstall import BuildinstallPhase, BuildinstallThread -from tests.helpers import _DummyCompose, PungiTestCase +from tests.helpers import DummyCompose, PungiTestCase -class BuildInstallCompose(_DummyCompose): +class BuildInstallCompose(DummyCompose): def __init__(self, *args, **kwargs): super(BuildInstallCompose, self).__init__(*args, **kwargs) self.variants = { diff --git a/tests/test_imagebuildphase.py b/tests/test_imagebuildphase.py index fc236481..8e030512 100755 --- a/tests/test_imagebuildphase.py +++ b/tests/test_imagebuildphase.py @@ -11,14 +11,14 @@ import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.phases.image_build import ImageBuildPhase, CreateImageBuildThread -from tests.helpers import _DummyCompose, PungiTestCase +from tests.helpers import DummyCompose, PungiTestCase class TestImageBuildPhase(PungiTestCase): @mock.patch('pungi.phases.image_build.ThreadPool') def test_image_build(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'image_build': { '^Client|Server$': [ { @@ -100,7 +100,7 @@ class TestImageBuildPhase(PungiTestCase): @mock.patch('pungi.phases.image_build.ThreadPool') def test_image_build_filter_all_variants(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'image_build': { '^Client|Server$': [ { @@ -131,7 +131,7 @@ class TestImageBuildPhase(PungiTestCase): @mock.patch('pungi.phases.image_build.ThreadPool') def test_image_build_set_install_tree(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'image_build': { '^Server$': [ { @@ -191,7 +191,7 @@ class TestImageBuildPhase(PungiTestCase): @mock.patch('pungi.phases.image_build.ThreadPool') def test_image_build_set_extra_repos(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'image_build': { '^Server$': [ { @@ -252,7 +252,7 @@ class TestImageBuildPhase(PungiTestCase): @mock.patch('pungi.phases.image_build.ThreadPool') def test_image_build_create_release(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'image_build': { '^Server$': [ { @@ -288,7 +288,7 @@ class TestImageBuildPhase(PungiTestCase): @mock.patch('pungi.phases.image_build.ThreadPool') def test_image_build_scratch_build(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'image_build': { '^Server$': [ { @@ -329,7 +329,7 @@ class TestCreateImageBuildThread(PungiTestCase): @mock.patch('pungi.phases.image_build.KojiWrapper') @mock.patch('pungi.phases.image_build.Linker') def test_process(self, Linker, KojiWrapper, get_file_size, get_mtime): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'koji_profile': 'koji' }) pool = mock.Mock() @@ -441,7 +441,7 @@ class TestCreateImageBuildThread(PungiTestCase): @mock.patch('pungi.phases.image_build.KojiWrapper') @mock.patch('pungi.phases.image_build.Linker') def test_process_handle_fail(self, Linker, KojiWrapper): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'koji_profile': 'koji', 'failable_deliverables': [ ('^.*$', { @@ -492,7 +492,7 @@ class TestCreateImageBuildThread(PungiTestCase): @mock.patch('pungi.phases.image_build.KojiWrapper') @mock.patch('pungi.phases.image_build.Linker') def test_process_handle_exception(self, Linker, KojiWrapper): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'koji_profile': 'koji', 'failable_deliverables': [ ('^.*$', { diff --git a/tests/test_imagechecksumphase.py b/tests/test_imagechecksumphase.py index 8be2c2fc..50595bdc 100755 --- a/tests/test_imagechecksumphase.py +++ b/tests/test_imagechecksumphase.py @@ -13,13 +13,13 @@ import shutil sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.phases.image_checksum import ImageChecksumPhase, dump_checksums -from tests.helpers import _DummyCompose, PungiTestCase +from tests.helpers import DummyCompose, PungiTestCase class TestImageChecksumPhase(PungiTestCase): def test_config_skip_individual_with_multiple_algorithms(self): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'media_checksums': ['md5', 'sha1'], 'media_checksum_one_file': True }) @@ -32,7 +32,7 @@ class TestImageChecksumPhase(PungiTestCase): @mock.patch('kobo.shortcuts.compute_file_checksums') @mock.patch('pungi.phases.image_checksum.dump_checksums') def test_checksum_one_file(self, dump, cc, exists): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'media_checksums': ['sha256'], 'media_checksum_one_file': True, }) @@ -52,7 +52,7 @@ class TestImageChecksumPhase(PungiTestCase): @mock.patch('kobo.shortcuts.compute_file_checksums') @mock.patch('pungi.phases.image_checksum.dump_checksums') def test_checksum_save_individuals(self, dump, cc, exists): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'media_checksums': ['md5', 'sha256'], }) @@ -83,7 +83,7 @@ class TestImageChecksumPhase(PungiTestCase): @mock.patch('kobo.shortcuts.compute_file_checksums') @mock.patch('pungi.phases.image_checksum.dump_checksums') def test_checksum_one_file_custom_name(self, dump, cc, exists): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'media_checksums': ['sha256'], 'media_checksum_one_file': True, 'media_checksum_base_filename': '%(release_short)s-%(variant)s-%(version)s-%(date)s%(type_suffix)s.%(respin)s' @@ -106,7 +106,7 @@ class TestImageChecksumPhase(PungiTestCase): @mock.patch('kobo.shortcuts.compute_file_checksums') @mock.patch('pungi.phases.image_checksum.dump_checksums') def test_checksum_save_individuals_custom_name(self, dump, cc, exists): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'media_checksums': ['md5', 'sha256'], 'media_checksum_base_filename': '%(release_short)s-%(variant)s-%(version)s-%(date)s%(type_suffix)s.%(respin)s' }) diff --git a/tests/test_liveimagesphase.py b/tests/test_liveimagesphase.py index ac06546d..8a2895a7 100755 --- a/tests/test_liveimagesphase.py +++ b/tests/test_liveimagesphase.py @@ -11,14 +11,14 @@ import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.phases.live_images import LiveImagesPhase, CreateLiveImageThread -from tests.helpers import _DummyCompose, PungiTestCase +from tests.helpers import DummyCompose, PungiTestCase class TestLiveImagesPhase(PungiTestCase): @mock.patch('pungi.phases.live_images.ThreadPool') def test_live_image_build(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'live_images': [ ('^Client$', { 'amd64': { @@ -61,7 +61,7 @@ class TestLiveImagesPhase(PungiTestCase): @mock.patch('pungi.phases.live_images.ThreadPool') def test_live_image_build_without_rename(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'live_images_no_rename': True, 'live_images': [ ('^Client$', { @@ -105,7 +105,7 @@ class TestLiveImagesPhase(PungiTestCase): @mock.patch('pungi.phases.live_images.ThreadPool') def test_live_image_build_two_images(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'live_images': [ ('^Client$', { 'amd64': [{ @@ -171,7 +171,7 @@ class TestLiveImagesPhase(PungiTestCase): @mock.patch('pungi.phases.live_images.ThreadPool') @mock.patch('pungi.phases.live_images.resolve_git_url') def test_spin_appliance(self, resolve_git_url, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'live_images': [ ('^Client$', { 'amd64': { @@ -225,7 +225,7 @@ class TestCreateLiveImageThread(PungiTestCase): @mock.patch('pungi.phases.live_images.run') @mock.patch('pungi.phases.live_images.KojiWrapper') def test_process(self, KojiWrapper, run, copy2, Image): - compose = _DummyCompose(self.topdir, {'koji_profile': 'koji'}) + compose = DummyCompose(self.topdir, {'koji_profile': 'koji'}) pool = mock.Mock() cmd = { 'ks_file': '/path/to/ks_file', @@ -303,7 +303,7 @@ class TestCreateLiveImageThread(PungiTestCase): @mock.patch('pungi.phases.live_images.run') @mock.patch('pungi.phases.live_images.KojiWrapper') def test_process_no_rename(self, KojiWrapper, run, copy2, Image): - compose = _DummyCompose(self.topdir, {'koji_profile': 'koji'}) + compose = DummyCompose(self.topdir, {'koji_profile': 'koji'}) pool = mock.Mock() cmd = { 'ks_file': '/path/to/ks_file', @@ -382,7 +382,7 @@ class TestCreateLiveImageThread(PungiTestCase): @mock.patch('pungi.phases.live_images.run') @mock.patch('pungi.phases.live_images.KojiWrapper') def test_process_applicance(self, KojiWrapper, run, copy2, Image): - compose = _DummyCompose(self.topdir, {'koji_profile': 'koji'}) + compose = DummyCompose(self.topdir, {'koji_profile': 'koji'}) pool = mock.Mock() cmd = { 'ks_file': '/path/to/ks_file', @@ -460,7 +460,7 @@ class TestCreateLiveImageThread(PungiTestCase): @mock.patch('pungi.phases.live_images.run') @mock.patch('pungi.phases.live_images.KojiWrapper') def test_process_handles_fail(self, KojiWrapper, run, copy2): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'koji_profile': 'koji', 'failable_deliverables': [('^.+$', {'*': ['live']})], }) @@ -497,7 +497,7 @@ class TestCreateLiveImageThread(PungiTestCase): @mock.patch('pungi.phases.live_images.run') @mock.patch('pungi.phases.live_images.KojiWrapper') def test_process_handles_exception(self, KojiWrapper, run, copy2): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'koji_profile': 'koji', 'failable_deliverables': [('^.+$', {'*': ['live']})], }) diff --git a/tests/test_livemediaphase.py b/tests/test_livemediaphase.py index 5c786b78..e20f98dc 100755 --- a/tests/test_livemediaphase.py +++ b/tests/test_livemediaphase.py @@ -10,13 +10,13 @@ import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) from pungi.phases.livemedia_phase import LiveMediaPhase, LiveMediaThread -from tests.helpers import _DummyCompose, PungiTestCase +from tests.helpers import DummyCompose, PungiTestCase class TestLiveMediaPhase(PungiTestCase): @mock.patch('pungi.phases.livemedia_phase.ThreadPool') def test_live_media_minimal(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'live_media': { '^Server$': [ { @@ -56,7 +56,7 @@ class TestLiveMediaPhase(PungiTestCase): @mock.patch('pungi.phases.livemedia_phase.ThreadPool') def test_live_media_non_existing_install_tree(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'live_media': { '^Server$': [ { @@ -79,7 +79,7 @@ class TestLiveMediaPhase(PungiTestCase): @mock.patch('pungi.phases.livemedia_phase.ThreadPool') def test_live_media_non_existing_repo(self, ThreadPool): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'live_media': { '^Server$': [ { @@ -103,7 +103,7 @@ class TestLiveMediaPhase(PungiTestCase): @mock.patch('pungi.phases.livemedia_phase.resolve_git_url') @mock.patch('pungi.phases.livemedia_phase.ThreadPool') def test_live_media_full(self, ThreadPool, resolve_git_url): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'live_media': { '^Server$': [ { @@ -161,7 +161,7 @@ class TestCreateImageBuildThread(PungiTestCase): @mock.patch('pungi.phases.livemedia_phase.KojiWrapper') @mock.patch('pungi.phases.livemedia_phase.Linker') def test_process(self, Linker, KojiWrapper, get_file_size, get_mtime): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'koji_profile': 'koji' }) config = { @@ -258,7 +258,7 @@ class TestCreateImageBuildThread(PungiTestCase): @mock.patch('pungi.phases.livemedia_phase.KojiWrapper') def test_handle_koji_fail(self, KojiWrapper): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'koji_profile': 'koji', 'failable_deliverables': [ ('^.+$', {'*': ['live-media']}) @@ -297,7 +297,7 @@ class TestCreateImageBuildThread(PungiTestCase): @mock.patch('pungi.phases.livemedia_phase.KojiWrapper') def test_handle_exception(self, KojiWrapper): - compose = _DummyCompose(self.topdir, { + compose = DummyCompose(self.topdir, { 'koji_profile': 'koji', 'failable_deliverables': [ ('^.+$', {'*': ['live-media']})