1 diff --git a/jenkinsapi_tests/unittests/test_build.py b/jenkinsapi_tests/unittests/test_build.py
2 index 2e2c2f4..9de816a 100644
3 --- a/jenkinsapi_tests/unittests/test_build.py
4 +++ b/jenkinsapi_tests/unittests/test_build.py
5 @@ -3,6 +3,7 @@ import pytest
10 from jenkinsapi.build import Build
11 from jenkinsapi.job import Job
13 @@ -252,7 +253,7 @@ def test_build_env_vars_wo_injected_env_vars_plugin(monkeypatch, build):
14 monkeypatch.setattr(Build, "get_data", fake_get_data)
16 with pytest.raises(requests.HTTPError) as excinfo:
17 - with pytest.warns(None) as record:
18 + with warnings.catch_warnings(record=True) as record:
20 assert "404" == str(excinfo.value)
21 assert len(record) == 1
22 @@ -269,7 +270,7 @@ def test_build_env_vars_other_exception(monkeypatch, build):
23 monkeypatch.setattr(Build, "get_data", fake_get_data)
25 with pytest.raises(Exception) as excinfo:
26 - with pytest.warns(None) as record:
27 + with warnings.catch_warnings(record=True) as record:
29 assert "" == str(excinfo.value)
30 assert len(record) == 0