make the test check

This commit is contained in:
zhuofeng 2023-02-20 10:14:05 +08:00
parent 9750cd3706
commit cfda9165cd
2 changed files with 64 additions and 2 deletions

View File

@ -0,0 +1,43 @@
From 5042fdb83644e09fc2d126ddc73c7f680b9472f7 Mon Sep 17 00:00:00 2001
From: shixuantong <shixuantong@huawei.com>
Date: Fri, 23 Apr 2021 16:47:29 +0800
Subject: [PATCH] Instances of pytest's tmp_path fixture in tests/test_bytecode_cache.py
have been replaced by instances of the older style tmpdir fixture
==================================== ERRORS ====================================
_______________ ERROR at setup of TestByteCodeCache.test_simple ________________
file /home/abuild/rpmbuild/BUILD/Jinja2-2.11.2/Jinja2-2.11.2/tests/test_bytecode_cache.py, line 18
def test_simple(self, env):
file /home/abuild/rpmbuild/BUILD/Jinja2-2.11.2/Jinja2-2.11.2/tests/test_bytecode_cache.py, line 11
@pytest.fixture
def env(package_loader, tmp_path):
E fixture 'tmp_path' not found
> available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, choice_loader, dict_loader, doctest_namespace, env, filesystem_loader, function_loader, monkeypatch, package_loader, prefix_loader, pytestconfig, record_property, record_xml_attribute, record_xml_property, recwarn, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/abuild/rpmbuild/BUILD/Jinja2-2.11.2/Jinja2-2.11.2/tests/test_bytecode_cache.py:11
=============== 653 passed, 8 skipped, 1 error in 14.76 seconds ================
pytest dependency is too low, tmp_path was added in 3.9.0, For details, see the pytest 3.9.0 release note at https://docs.pytest.org/en/stable/changelog.html
---
Jinja2-2.11.2/tests/test_bytecode_cache.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Jinja2-2.11.2/tests/test_bytecode_cache.py b/Jinja2-2.11.2/tests/test_bytecode_cache.py
index c7882b1..d0a4352 100644
--- a/Jinja2-2.11.2/tests/test_bytecode_cache.py
+++ b/Jinja2-2.11.2/tests/test_bytecode_cache.py
@@ -9,8 +9,8 @@ from jinja2.exceptions import TemplateNotFound
@pytest.fixture
-def env(package_loader, tmp_path):
- bytecode_cache = FileSystemBytecodeCache(str(tmp_path))
+def env(package_loader, tmpdir):
+ bytecode_cache = FileSystemBytecodeCache(str(tmpdir))
return Environment(loader=package_loader, bytecode_cache=bytecode_cache)
--
2.23.0

View File

@ -2,13 +2,16 @@
Name: python-jinja2
Version: 2.11.2
Release: 2
Release: 3
Summary: A full-featured template engine for Python
License: BSD
URL: http://jinja.pocoo.org/
Source0: https://files.pythonhosted.org/packages/source/J/Jinja2/Jinja2-%{version}.tar.gz
Patch6000: backport-CVE-2020-28493.patch
Patch9000: huawei-replace-instances-of-the-older-style-tmpdir-fixture.patch
BuildArch: noarch
%description
@ -78,6 +81,16 @@ pushd python3
%py3_install
popd
%check
%if %{with python2}
pushd Jinja2-%{version}
PYTHONPATH=$(pwd)/src %{__python2} -m pytest tests
popd
%endif
pushd python3
PYTHONPATH=$(pwd)/src %{__python3} -m pytest tests
popd
%if %{with python2}
%files -n python2-jinja2
%license Jinja2-%{version}/LICENSE.rst
@ -95,7 +108,13 @@ popd
%doc Jinja2-%{version}/ext Jinja2-%{version}/examples
%changelog
* Fri Apr 23 2021 shangyibin <shangyibin1@huawei.com> - 2.11.2-2
* Sat Feb 18 2023 zhuofeng <zhuofeng2@huawei.com> - 2.11.2-3
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:make the test check
* Fri Apr 23 2021 shangyibin<shangyibin1@huawei.com> - 2.11.2-2
- Type:NA
- ID:CVE-2020-28493
- SUG:NA