Skip to content

Commit

Permalink
Test: Speed up Nexus tests
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
eb-oss committed Feb 22, 2022
1 parent a9eec3a commit 23ead2b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_nexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit 23ead2b

Please sign in to comment.