From f9631e9eb49a6d0e8a0851d88d5ef73ab9ec5be2 Mon Sep 17 00:00:00 2001 From: CJ Steiner Date: Wed, 18 Dec 2024 07:06:04 -0600 Subject: [PATCH] test_build: fix failing tests --- jenkinsapi_tests/unittests/test_build.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jenkinsapi_tests/unittests/test_build.py b/jenkinsapi_tests/unittests/test_build.py index a53c439c..37fae50e 100644 --- a/jenkinsapi_tests/unittests/test_build.py +++ b/jenkinsapi_tests/unittests/test_build.py @@ -3,6 +3,7 @@ import pytz from . import configs import datetime +import warnings from typing import List from jenkinsapi.build import Build from jenkinsapi.job import Job @@ -258,7 +259,7 @@ def fake_get_data(cls, tree=None, params=None): monkeypatch.setattr(Build, "get_data", fake_get_data) with pytest.raises(requests.HTTPError) as excinfo: - with pytest.warns(None) as record: + with pytest.warns(UserWarning) as record: build.get_env_vars() assert "404" == str(excinfo.value) assert len(record) == 1 @@ -275,10 +276,9 @@ def fake_get_data(cls, tree=None, params=None): monkeypatch.setattr(Build, "get_data", fake_get_data) with pytest.raises(Exception) as excinfo: - with pytest.warns(None) as record: + with warnings.catch_warnings(): build.get_env_vars() assert "" == str(excinfo.value) - assert len(record) == 0 def test_build_get_status(build) -> None: