pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/devel/py-test-lazy-fixture



Module Name:    pkgsrc
Committed By:   wiz
Date:           Sun Jul 14 06:07:13 UTC 2024

Modified Files:
        pkgsrc/devel/py-test-lazy-fixture: Makefile distinfo
Added Files:
        pkgsrc/devel/py-test-lazy-fixture/patches: patch-pytest__lazyfixture.py

Log Message:
py-test-lazy-fixture: add patch for compatibility with pytest 8

>From upstream bug report

Bump PKGREVISION.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 pkgsrc/devel/py-test-lazy-fixture/Makefile
cvs rdiff -u -r1.1 -r1.2 pkgsrc/devel/py-test-lazy-fixture/distinfo
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/devel/py-test-lazy-fixture/patches/patch-pytest__lazyfixture.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/devel/py-test-lazy-fixture/Makefile
diff -u pkgsrc/devel/py-test-lazy-fixture/Makefile:1.2 pkgsrc/devel/py-test-lazy-fixture/Makefile:1.3
--- pkgsrc/devel/py-test-lazy-fixture/Makefile:1.2      Sun May  5 22:08:54 2024
+++ pkgsrc/devel/py-test-lazy-fixture/Makefile  Sun Jul 14 06:07:12 2024
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.2 2024/05/05 22:08:54 wiz Exp $
+# $NetBSD: Makefile,v 1.3 2024/07/14 06:07:12 wiz Exp $
 
 DISTNAME=      pytest-lazy-fixture-0.6.3
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME:S/py//}
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    devel python
 MASTER_SITES=  ${MASTER_SITE_PYPI:=p/pytest-lazy-fixture/}
 

Index: pkgsrc/devel/py-test-lazy-fixture/distinfo
diff -u pkgsrc/devel/py-test-lazy-fixture/distinfo:1.1 pkgsrc/devel/py-test-lazy-fixture/distinfo:1.2
--- pkgsrc/devel/py-test-lazy-fixture/distinfo:1.1      Mon Feb 14 08:52:02 2022
+++ pkgsrc/devel/py-test-lazy-fixture/distinfo  Sun Jul 14 06:07:12 2024
@@ -1,5 +1,6 @@
-$NetBSD: distinfo,v 1.1 2022/02/14 08:52:02 adam Exp $
+$NetBSD: distinfo,v 1.2 2024/07/14 06:07:12 wiz Exp $
 
 BLAKE2s (pytest-lazy-fixture-0.6.3.tar.gz) = 9874c65454885e5ae0606235545ed2dc437b3e9c9724d27426f1811ba51e8b63
 SHA512 (pytest-lazy-fixture-0.6.3.tar.gz) = 3281edc516f21f23104d7fc188b5c9aecf364f55109dab52865cbfef4a540727eb2bd42fb9806a7e8be728b249bc7a224ffdbab96473f043bef9a7aea1e4baa8
 Size (pytest-lazy-fixture-0.6.3.tar.gz) = 7878 bytes
+SHA1 (patch-pytest__lazyfixture.py) = a48e8aa803f6416516a2ab15f1bcdbff71dc40b4

Added files:

Index: pkgsrc/devel/py-test-lazy-fixture/patches/patch-pytest__lazyfixture.py
diff -u /dev/null pkgsrc/devel/py-test-lazy-fixture/patches/patch-pytest__lazyfixture.py:1.1
--- /dev/null   Sun Jul 14 06:07:13 2024
+++ pkgsrc/devel/py-test-lazy-fixture/patches/patch-pytest__lazyfixture.py      Sun Jul 14 06:07:13 2024
@@ -0,0 +1,71 @@
+$NetBSD: patch-pytest__lazyfixture.py,v 1.1 2024/07/14 06:07:13 wiz Exp $
+
+Fix compatibility with pytest 8.
+https://github.com/TvoroG/pytest-lazy-fixture/issues/65
+
+diff --git a/pytest_lazyfixture.py b/pytest_lazyfixture.py
+index abf5db5..df83ce7 100644
+--- pytest_lazyfixture.py.orig 2020-02-01 17:28:55.000000000 +0000
++++ pytest_lazyfixture.py
+@@ -71,14 +71,13 @@ def pytest_make_parametrize_id(config, v
+ def pytest_generate_tests(metafunc):
+     yield
+ 
+-    normalize_metafunc_calls(metafunc, 'funcargs')
+-    normalize_metafunc_calls(metafunc, 'params')
++    normalize_metafunc_calls(metafunc)
+ 
+ 
+-def normalize_metafunc_calls(metafunc, valtype, used_keys=None):
++def normalize_metafunc_calls(metafunc, used_keys=None):
+     newcalls = []
+     for callspec in metafunc._calls:
+-        calls = normalize_call(callspec, metafunc, valtype, used_keys)
++        calls = normalize_call(callspec, metafunc, used_keys)
+         newcalls.extend(calls)
+     metafunc._calls = newcalls
+ 
+@@ -98,17 +97,21 @@ def copy_metafunc(metafunc):
+     return copied
+ 
+ 
+-def normalize_call(callspec, metafunc, valtype, used_keys):
++def normalize_call(callspec, metafunc, used_keys):
+     fm = metafunc.config.pluginmanager.get_plugin('funcmanage')
+ 
+     used_keys = used_keys or set()
+-    valtype_keys = set(getattr(callspec, valtype).keys()) - used_keys
++    keys = set(callspec.params.keys()) - used_keys
++    print(used_keys, keys)
+ 
+-    for arg in valtype_keys:
+-        val = getattr(callspec, valtype)[arg]
++    for arg in keys:
++        val = callspec.params[arg]
+         if is_lazy_fixture(val):
+             try:
+-                _, fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure([val.name], metafunc.definition.parent)
++                if pytest.version_tuple >= (8, 0, 0):
++                    fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure(metafunc.definition.parent, [val.name], {})
++                else:
++                    _, fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure([val.name], metafunc.definition.parent)
+             except ValueError:
+                 # 3.6.0 <= pytest < 3.7.0; `FixtureManager.getfixtureclosure` returns 2 values
+                 fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure([val.name], metafunc.definition.parent)
+@@ -117,14 +120,14 @@ def normalize_call(callspec, metafunc, v
+                 fixturenames_closure, arg2fixturedefs = fm.getfixtureclosure([val.name], current_node)
+ 
+             extra_fixturenames = [fname for fname in fixturenames_closure
+-                                  if fname not in callspec.params and fname not in callspec.funcargs]
++                                  if fname not in callspec.params]# and fname not in callspec.funcargs]
+ 
+             newmetafunc = copy_metafunc(metafunc)
+             newmetafunc.fixturenames = extra_fixturenames
+             newmetafunc._arg2fixturedefs.update(arg2fixturedefs)
+             newmetafunc._calls = [callspec]
+             fm.pytest_generate_tests(newmetafunc)
+-            normalize_metafunc_calls(newmetafunc, valtype, used_keys | set([arg]))
++            normalize_metafunc_calls(newmetafunc, used_keys | set([arg]))
+             return newmetafunc._calls
+ 
+         used_keys.add(arg)



Home | Main Index | Thread Index | Old Index