From 23ead2b8ee44bbf6317e68ffd502852fdb2bdd8f Mon Sep 17 00:00:00 2001 From: Eric Ball Date: Tue, 22 Feb 2022 10:58:04 -0800 Subject: [PATCH] Test: Speed up Nexus tests By patching the sleep function, we can remove about 25 seconds of pauses during unit testing of release_staging_repos method. Issue: RELENG-4052 Change-Id: I8692c1183d70873348616435074b9b69193dda41 Signed-off-by: Eric Ball --- tests/test_nexus.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_nexus.py b/tests/test_nexus.py index 37a2e288..fbd4ce4b 100644 --- a/tests/test_nexus.py +++ b/tests/test_nexus.py @@ -56,7 +56,7 @@ def test_create_roles(datafiles, responses, nexus2_obj_create): @pytest.mark.datafiles(os.path.join(FIXTURE_DIR, "nexus")) -def test_release_staging_repos(datafiles, responses, nexus2_obj_create, mock_get_credentials): +def test_release_staging_repos(datafiles, responses, mocker, nexus2_obj_create, mock_get_credentials): """Test create_roles() method with good config.""" os.chdir(str(datafiles)) baseurl = "http://nexus.localhost/service/local" @@ -68,6 +68,8 @@ def test_release_staging_repos(datafiles, responses, nexus2_obj_create, mock_get releasing_return = open("staging_activities_releasing.xml", "r").read() released_return = open("staging_activities_released.xml", "r").read() + mocker.patch.object(cmd, "sleep") + responses.add(responses.GET, activity_url, closed_return, status=200) responses.add(responses.POST, request_url, status=201) # While checking for the "release" activity, we return once without it in -- 2.16.6