]> git.pld-linux.org Git - packages/python-pytest-black.git/commitdiff
- added pytest patch (adjust black tests for pytest 6); release 2 auto/th/python-pytest-black-0.3.12-2
authorJakub Bogusz <qboosh@pld-linux.org>
Sun, 20 Mar 2022 14:33:55 +0000 (15:33 +0100)
committerJakub Bogusz <qboosh@pld-linux.org>
Sun, 20 Mar 2022 14:34:41 +0000 (15:34 +0100)
python-pytest-black-pytest.patch [new file with mode: 0644]
python-pytest-black.spec

diff --git a/python-pytest-black-pytest.patch b/python-pytest-black-pytest.patch
new file mode 100644 (file)
index 0000000..b1da589
--- /dev/null
@@ -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)
index 80549e9be263c512be368b21c3f6b63eab892fee..05f4177b6c9687c0ddd5981885e1f547ca6d00fc 100644 (file)
@@ -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}
This page took 0.135719 seconds and 4 git commands to generate.