python3Packages.jenkinsapi: fix build (#420212)

This commit is contained in:
Aleksana
2025-06-26 20:23:56 +08:00
committed by GitHub
2 changed files with 6 additions and 36 deletions
@@ -1,7 +1,7 @@
{
lib,
buildPythonPackage,
fetchPypi,
fetchFromGitHub,
flit-core,
mock,
pbr,
@@ -18,13 +18,13 @@ buildPythonPackage rec {
version = "0.3.14";
format = "pyproject";
src = fetchPypi {
inherit pname version;
hash = "sha256-G+Wj1gu5e4/VqdnUR34iAeB+RyWn1CwOsWhGu4eeS5c=";
src = fetchFromGitHub {
owner = "pycontribs";
repo = "jenkinsapi";
tag = version;
hash = "sha256-s6yamzH+4tobO8gLFVn+5ZZUnmPja675FXQmIjAb/co=";
};
patches = [ ./pytest-warn-none.patch ];
nativeBuildInputs = [
flit-core
pbr
@@ -1,30 +0,0 @@
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