[packages/python-pytest-black] - added pytest patch (adjust black tests for pytest 6); release 2

qboosh qboosh at pld-linux.org
Sun Mar 20 15:32:47 CET 2022


commit 3632a4004a2595b23cae1fa2c86634f7a3af744d
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Mar 20 15:33:55 2022 +0100

    - added pytest patch (adjust black tests for pytest 6); release 2

 python-pytest-black-pytest.patch | 65 ++++++++++++++++++++++++++++++++++++++++
 python-pytest-black.spec         |  6 ++--
 2 files changed, 69 insertions(+), 2 deletions(-)
---
diff --git a/python-pytest-black.spec b/python-pytest-black.spec
index 80549e9..05f4177 100644
--- a/python-pytest-black.spec
+++ b/python-pytest-black.spec
@@ -8,12 +8,13 @@ Summary:	pytest plugin to enable format checking with black
 Summary(pl.UTF-8):	Wtyczka pytesta do sprawdzania formatowania przy użyciu modułu black
 Name:		python-pytest-black
 Version:	0.3.12
-Release:	1
+Release:	2
 License:	MIT
 Group:		Libraries/Python
 #Source0Download: https://pypi.org/simple/pytest-black/
 Source0:	https://files.pythonhosted.org/packages/source/p/pytest-black/pytest-black-%{version}.tar.gz
 # Source0-md5:	5c44840754f9edfb5c775768aa07990a
+Patch0:		%{name}-pytest.patch
 URL:		https://pypi.org/project/pytest-black/
 %if %{with python2}
 BuildRequires:	python-modules >= 1:2.7
@@ -30,7 +31,7 @@ BuildRequires:	python3-setuptools
 BuildRequires:	python3-setuptools_scm
 %if %{with tests}
 BuildRequires:	python3-black >= 19.3b0
-BuildRequires:	python3-pytest >= 3.5.0
+BuildRequires:	python3-pytest >= 6
 BuildRequires:	python3-toml
 %endif
 %endif
@@ -64,6 +65,7 @@ Wtyczka pytesta do sprawdzania formatowania przy użyciu modułu black
 
 %prep
 %setup -q -n pytest-black-%{version}
+%patch0 -p1
 
 %build
 %if %{with python2}
diff --git a/python-pytest-black-pytest.patch b/python-pytest-black-pytest.patch
new file mode 100644
index 0000000..b1da589
--- /dev/null
+++ b/python-pytest-black-pytest.patch
@@ -0,0 +1,65 @@
+Fix testdir.makefile usage according to:
+https://github.com/pytest-dev/pytest/issues/8192
+
+--- pytest-black-0.3.12/tests/test_black.py.orig	2020-10-05 11:41:50.000000000 +0200
++++ pytest-black-0.3.12/tests/test_black.py	2022-03-20 15:31:40.434889879 +0100
+@@ -71,8 +71,7 @@ def test_mtime_cache(testdir):
+ def test_exclude(testdir):
+     """Assert test is skipped if path is excluded even if also included
+     """
+-    testdir.makefile(
+-        "pyproject.toml",
++    testdir.makepyprojecttoml(
+         """
+         [tool.black]
+             include = 'test_exclude.py'
+@@ -89,9 +88,6 @@ def test_exclude(testdir):
+     # replace trailing newline (stripped by testdir.makepyfile)
+     p = p.write(p.read() + "\n")
+ 
+-    # Rename pyproject.toml ¯\_(ツ)_/¯
+-    testdir.run("mv", "test_exclude.pyproject.toml", "pyproject.toml")
+-
+     result = testdir.runpytest("--black")
+     result.assert_outcomes(skipped=1, passed=0)
+ 
+@@ -99,8 +95,7 @@ def test_exclude(testdir):
+ def test_exclude_folder(testdir):
+     """Assert test is skipped for files in a folder
+     """
+-    testdir.makefile(
+-        "pyproject.toml",
++    testdir.makepyprojecttoml(
+         """
+         [tool.black]
+             exclude = '''
+@@ -126,9 +121,6 @@ def test_exclude_folder(testdir):
+     ignore_folder = testdir.mkdir("ignore_folder")
+     testdir.run("mv", "test_exclude_folder.py", ignore_folder)
+ 
+-    # Rename pyproject.toml ¯\_(ツ)_/¯
+-    testdir.run("mv", "test_exclude_folder.pyproject.toml", "pyproject.toml")
+-
+     result = testdir.runpytest("--black")
+     result.assert_outcomes(skipped=1, passed=0)
+ 
+@@ -136,8 +128,7 @@ def test_exclude_folder(testdir):
+ def test_include(testdir):
+     """Assert test is not skipped if path is included but not excluded
+     """
+-    testdir.makefile(
+-        "pyproject.toml",
++    testdir.makepyprojecttoml(
+         """
+         [tool.black]
+             include = 'test_include'
+@@ -153,9 +144,6 @@ def test_include(testdir):
+     # replace trailing newline (stripped by testdir.makepyfile)
+     p = p.write(p.read() + "\n")
+ 
+-    # Rename pyproject.toml ¯\_(ツ)_/¯
+-    testdir.run("mv", "test_include.pyproject.toml", "pyproject.toml")
+-
+     result = testdir.runpytest("--black")
+     result.assert_outcomes(skipped=0, passed=1)
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-pytest-black.git/commitdiff/3632a4004a2595b23cae1fa2c86634f7a3af744d



More information about the pld-cvs-commit mailing list