From d83f210297c08668f9f972308a1d010cc3e4851a Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Fri, 18 Nov 2016 10:19:41 -0500 Subject: [PATCH] Get tests of the retry decorator working in the test suite. --- config.py | 2 +- module_build_service/__init__.py | 4 +++- tests/test_builder/test_koji.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config.py b/config.py index 592be47c..3e04f5e1 100644 --- a/config.py +++ b/config.py @@ -113,7 +113,7 @@ class TestConfiguration(BaseConfiguration): DEBUG = True # Global network-related values, in seconds - NET_TIMEOUT = 5 + NET_TIMEOUT = 3 NET_RETRY_INTERVAL = 1 KOJI_PROFILE = 'staging' diff --git a/module_build_service/__init__.py b/module_build_service/__init__.py index 0231e7b0..de4ab07e 100644 --- a/module_build_service/__init__.py +++ b/module_build_service/__init__.py @@ -54,7 +54,9 @@ app = Flask(__name__) app.config.from_envvar("RIDA_SETTINGS", silent=True) here = sys.path[0] -if here not in ('/usr/bin', '/bin', '/usr/local/bin'): +if any(['nosetests' in arg for arg in sys.argv]): + app.config.from_object('config.TestConfiguration') +elif here not in ('/usr/bin', '/bin', '/usr/local/bin'): app.config.from_object('config.DevConfiguration') else: app.config.from_object('config.ProdConfiguration') diff --git a/tests/test_builder/test_koji.py b/tests/test_builder/test_koji.py index 43c7a0ca..5637c4c0 100644 --- a/tests/test_builder/test_koji.py +++ b/tests/test_builder/test_koji.py @@ -70,7 +70,7 @@ class TestKojiBuilder(unittest.TestCase): with self.assertRaises(IOError): fake_kmb.buildroot_ready() - self.assertEquals(mocked_kojiutil.checkForBuilds.call_count, 5) + self.assertEquals(mocked_kojiutil.checkForBuilds.call_count, 3) class FakeKojiModuleBuilder(KojiModuleBuilder):