From a42d0575df466d1c982b4e0cbb623cf9e91f6401 Mon Sep 17 00:00:00 2001 From: Riccardo Murri Date: Fri, 2 Sep 2016 16:10:33 +0200 Subject: [PATCH] New sub-package `gc3libs.testing` to hold utilities for writing unit tests. --- gc3libs/testing/__init__.py | 22 +++++++++++++++++++ gc3libs/{tests => testing}/helpers.py | 0 gc3libs/tests/test_ParallelTaskCollection.py | 2 +- .../tests/test_SequentialTaskCollection.py | 2 +- gc3libs/tests/test_Task.py | 2 +- gc3libs/tests/test_core.py | 2 +- gc3libs/tests/test_engine.py | 2 +- gc3libs/tests/test_workflow.py | 2 +- 8 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 gc3libs/testing/__init__.py rename gc3libs/{tests => testing}/helpers.py (100%) diff --git a/gc3libs/testing/__init__.py b/gc3libs/testing/__init__.py new file mode 100644 index 00000000..07c6510f --- /dev/null +++ b/gc3libs/testing/__init__.py @@ -0,0 +1,22 @@ +# __init__.py +# -*- coding: utf-8 -*- +""" +Sub-package of utility function to aid in writing GC3Pie unit tests. +""" +# +# Copyright (C) 2016, University of Zurich. +# +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA diff --git a/gc3libs/tests/helpers.py b/gc3libs/testing/helpers.py similarity index 100% rename from gc3libs/tests/helpers.py rename to gc3libs/testing/helpers.py diff --git a/gc3libs/tests/test_ParallelTaskCollection.py b/gc3libs/tests/test_ParallelTaskCollection.py index 2a44ef6e..311a3b93 100755 --- a/gc3libs/tests/test_ParallelTaskCollection.py +++ b/gc3libs/tests/test_ParallelTaskCollection.py @@ -30,7 +30,7 @@ from nose.tools import raises, assert_equal -from helpers import SimpleParallelTaskCollection, SuccessfulApp, UnsuccessfulApp, temporary_core +from gc3libs.testing.helpers SimpleParallelTaskCollection, SuccessfulApp, UnsuccessfulApp, temporary_core ## tests diff --git a/gc3libs/tests/test_SequentialTaskCollection.py b/gc3libs/tests/test_SequentialTaskCollection.py index 20be6148..0a0517b2 100755 --- a/gc3libs/tests/test_SequentialTaskCollection.py +++ b/gc3libs/tests/test_SequentialTaskCollection.py @@ -30,7 +30,7 @@ from nose.tools import raises, assert_equal -from helpers import SimpleSequentialTaskCollection, SuccessfulApp, UnsuccessfulApp, temporary_core +from gc3libs.testing.helpers SimpleSequentialTaskCollection, SuccessfulApp, UnsuccessfulApp, temporary_core ## tests diff --git a/gc3libs/tests/test_Task.py b/gc3libs/tests/test_Task.py index c7215c5e..2bbf6a12 100755 --- a/gc3libs/tests/test_Task.py +++ b/gc3libs/tests/test_Task.py @@ -29,7 +29,7 @@ from nose.tools import raises, assert_equal -from helpers import SuccessfulApp, UnsuccessfulApp, temporary_core +from gc3libs.testing.helpers SuccessfulApp, UnsuccessfulApp, temporary_core ## tests diff --git a/gc3libs/tests/test_core.py b/gc3libs/tests/test_core.py index f7753b04..297fd48f 100644 --- a/gc3libs/tests/test_core.py +++ b/gc3libs/tests/test_core.py @@ -36,7 +36,7 @@ def assert_is_instance(obj, cls): from gc3libs.core import Core, MatchMaker from gc3libs.quantity import GB, hours -from helpers import temporary_config +from gc3libs.testing.helpers temporary_config @raises(gc3libs.exceptions.NoResources) diff --git a/gc3libs/tests/test_engine.py b/gc3libs/tests/test_engine.py index 6702447b..f33905f1 100644 --- a/gc3libs/tests/test_engine.py +++ b/gc3libs/tests/test_engine.py @@ -40,7 +40,7 @@ def assert_is_instance(obj, cls): from gc3libs.core import Core, Engine, MatchMaker from gc3libs.quantity import GB, hours -from helpers import SimpleParallelTaskCollection, SimpleSequentialTaskCollection, SuccessfulApp, temporary_config, temporary_engine +from gc3libs.testing.helpers SimpleParallelTaskCollection, SimpleSequentialTaskCollection, SuccessfulApp, temporary_config, temporary_engine def test_engine_progress(num_jobs=1, transition_graph=None, max_iter=100): diff --git a/gc3libs/tests/test_workflow.py b/gc3libs/tests/test_workflow.py index 887c1f54..487dfae5 100644 --- a/gc3libs/tests/test_workflow.py +++ b/gc3libs/tests/test_workflow.py @@ -38,7 +38,7 @@ def assert_is_instance(obj, cls): from gc3libs import Run from gc3libs.workflow import SequentialTaskCollection, StagedTaskCollection, StopOnError -from helpers import SuccessfulApp, UnsuccessfulApp, temporary_core +from gc3libs.testing.helpers SuccessfulApp, UnsuccessfulApp, temporary_core def test_staged_task_collection_progress():