From: Eric Ball Date: Tue, 22 Feb 2022 18:58:04 +0000 (-0800) Subject: Test: Speed up Nexus tests X-Git-Tag: v0.36.0~2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F20%2F69720%2F3;p=releng%2Flftools.git 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 --- 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