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