Fix building for pytest

This commit is contained in:
baizg1107 2021-01-12 16:10:58 +08:00
parent 3ae9a5b091
commit 7a8da28fb9
2 changed files with 36 additions and 2 deletions

View File

@ -0,0 +1,29 @@
From 2ecfbe1d82ef2bcb6bba3d9d8a71dcc8e7811021 Mon Sep 17 00:00:00 2001
From: baizg1107 <preloyalwhite@163.com>
Date: Tue, 12 Jan 2021 11:18:35 +0800
Subject: [PATCH] fix build for pytest
---
tests/conftest.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index c25e302..6a977ec 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -34,6 +34,11 @@ def pytest_addoption(parser):
def pytest_runtest_setup(item):
skip_servertest = item.config.getoption(SKIP_SERVERTEST)
- if skip_servertest and item.get_marker("servertest") is not None:
+ #pytest 4+
+ if hasattr(item, 'get_closest_marker'):
+ get_marker = item.get_closest_marker
+ else:
+ get_marker = item.get_marker
+ if skip_servertest and get_marker("servertest") is not None:
# args has --skip-servertests and test is marked as servertest
pytest.skip("Skip integration test")
--
2.23.0

View File

@ -1,6 +1,6 @@
Name: custodia
Version: 0.6.0
Release: 5
Release: 6
Summary: A tool for managing secrets other processes
License: GPLv3+
URL: https://github.com/latchset/%{name}
@ -11,6 +11,8 @@ Source4: custodia@.socket
Source5: custodia.tmpfiles.conf
BuildArch: noarch
Patch0: 0001-fix-build-for-pytest.patch
BuildRequires: systemd python3-devel python3-jwcrypto >= 0.4.2
BuildRequires: python3-requests python3-setuptools > 18 python3-coverage
BuildRequires: python3-pytest python3-docutils python3-systemd
@ -47,7 +49,7 @@ Custodia is modular, the configuration file controls how authentication,
authorization, storage and API plugins are combined and exposed.
%prep
%autosetup -p1
%autosetup -n %{name}-%{version} -p1
%build
%py3_build
@ -128,5 +130,8 @@ exit 0
%{python3_sitelib}/%{name}-%{version}-py%{python3_version}-nspkg.pth
%changelog
* Fri Jan 8 2021 baizhonggui <baizhonggui> 0.6.0-6
- Fix building for pytest
* Fri May 15 2020 Captain Wei <captain.a.wei@gmail.com> 0.6.0-5
- Package init