Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-pytest for openSUSE:Factory 
checked in at 2021-12-30 15:55:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest (Old)
 and      /work/SRC/openSUSE:Factory/.python-pytest.new.1896 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pytest"

Thu Dec 30 15:55:22 2021 rev:68 rq:942999 version:6.2.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pytest/python-pytest.changes      
2021-12-22 20:17:46.547838872 +0100
+++ /work/SRC/openSUSE:Factory/.python-pytest.new.1896/python-pytest.changes    
2021-12-30 15:55:34.652661806 +0100
@@ -1,0 +2,8 @@
+Tue Dec 28 16:52:14 UTC 2021 - Ben Greiner <c...@bnavigator.de>
+
+- Add patch pytest-pr9173-importlib-py310.patch
+  * gh#pytest-dev/pytest#9173
+  * refresh pytest-pr9417-py3.10.1-fail.patch
+  * fixes asdf related errors: gh#asdf-format/asdf#1027
+
+-------------------------------------------------------------------

New:
----
  pytest-pr9173-importlib-py310.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pytest.spec ++++++
--- /var/tmp/diff_new_pack.mxdcVd/_old  2021-12-30 15:55:35.260662275 +0100
+++ /var/tmp/diff_new_pack.mxdcVd/_new  2021-12-30 15:55:35.264662277 +0100
@@ -43,8 +43,10 @@
 Source:         
https://files.pythonhosted.org/packages/source/p/pytest/pytest-%{version}.tar.gz
 # PATCH-FIX-UPSTREAM pytest-pr8664-py3.10-test_trial_error-fail.patch -- 
gh#pytest-dev/pytest#8664
 Patch0:         pytest-pr8664-py3.10-test_trial_error-fail.patch
+# PATCH-FIX-UPSTREAM pytest-pr9173-importlib-py310.patch -- 
gh#pytest-dev/pytest#9173
+Patch1:         pytest-pr9173-importlib-py310.patch
 # PATCH-FIX-UPSTREAM pytest-pr9417-py3.10.1-fail.patch -- 
gh#pytest-dev/pytest#9417
-Patch1:         pytest-pr9417-py3.10.1-fail.patch
+Patch2:         pytest-pr9417-py3.10.1-fail.patch
 BuildRequires:  %{python_module setuptools >= 42.0}
 BuildRequires:  %{python_module setuptools_scm}
 BuildRequires:  %{python_module toml}

++++++ pytest-pr9173-importlib-py310.patch ++++++
Index: pytest-6.2.5/changelog/9169.bugfix.rst
===================================================================
--- /dev/null
+++ pytest-6.2.5/changelog/9169.bugfix.rst
@@ -0,0 +1 @@
+Support for the ``files`` API from ``importlib.resources`` within rewritten 
files.
Index: pytest-6.2.5/src/_pytest/assertion/rewrite.py
===================================================================
--- pytest-6.2.5.orig/src/_pytest/assertion/rewrite.py
+++ pytest-6.2.5/src/_pytest/assertion/rewrite.py
@@ -63,7 +63,7 @@ class AssertionRewritingHook(importlib.a
         except ValueError:
             self.fnpats = ["test_*.py", "*_test.py"]
         self.session: Optional[Session] = None
-        self._rewritten_names: Set[str] = set()
+        self._rewritten_names: Dict[str, Path] = {}
         self._must_rewrite: Set[str] = set()
         # flag to guard against trying to rewrite a pyc file while we are 
already writing another pyc file,
         # which might result in infinite recursion (#3506)
@@ -133,7 +133,7 @@ class AssertionRewritingHook(importlib.a
         fn = Path(module.__spec__.origin)
         state = self.config._store[assertstate_key]
 
-        self._rewritten_names.add(module.__name__)
+        self._rewritten_names[module.__name__] = fn
 
         # The requested module looks like a test file, so rewrite it. This is
         # the most magical part of the process: load the source, rewrite the
@@ -275,6 +275,14 @@ class AssertionRewritingHook(importlib.a
         with open(pathname, "rb") as f:
             return f.read()
 
+    if sys.version_info >= (3, 9):
+
+        def get_resource_reader(self, name: str) -> 
importlib.abc.TraversableResources:  # type: ignore
+            from types import SimpleNamespace
+            from importlib.readers import FileReader
+
+            return 
FileReader(SimpleNamespace(path=self._rewritten_names[name]))
+
 
 def _write_pyc_fp(
     fp: IO[bytes], source_stat: os.stat_result, co: types.CodeType
Index: pytest-6.2.5/testing/test_assertrewrite.py
===================================================================
--- pytest-6.2.5.orig/testing/test_assertrewrite.py
+++ pytest-6.2.5/testing/test_assertrewrite.py
@@ -771,6 +771,35 @@ class TestRewriteOnImport:
         )
         assert pytester.runpytest().ret == ExitCode.NO_TESTS_COLLECTED
 
+    @pytest.mark.skipif(
+        sys.version_info < (3, 9),
+        reason="importlib.resources.files was introduced in 3.9",
+    )
+    def test_load_resource_via_files_with_rewrite(self, pytester: Pytester) -> 
None:
+        example = pytester.path.joinpath("demo") / "example"
+        init = pytester.path.joinpath("demo") / "__init__.py"
+        pytester.makepyfile(
+            **{
+                "demo/__init__.py": """
+                from importlib.resources import files
+
+                def load():
+                    return files(__name__)
+                """,
+                "test_load": f"""
+                pytest_plugins = ["demo"]
+
+                def test_load():
+                    from demo import load
+                    found = {{str(i) for i in load().iterdir() if i.name != 
"__pycache__"}}
+                    assert found == {{{str(example)!r}, {str(init)!r}}}
+                """,
+            }
+        )
+        example.mkdir()
+
+        assert pytester.runpytest("-vv").ret == ExitCode.OK
+
     def test_readonly(self, pytester: Pytester) -> None:
         sub = pytester.mkdir("testing")
         sub.joinpath("test_readonly.py").write_bytes(

++++++ pytest-pr9417-py3.10.1-fail.patch ++++++
--- /var/tmp/diff_new_pack.mxdcVd/_old  2021-12-30 15:55:35.316662317 +0100
+++ /var/tmp/diff_new_pack.mxdcVd/_new  2021-12-30 15:55:35.332662330 +0100
@@ -12,11 +12,11 @@
  testing/test_skipping.py   | 2 --
  2 files changed, 2 insertions(+), 4 deletions(-)
 
-diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
-index 92e2dc6be7..bbc48adb49 100644
---- a/.github/workflows/main.yml
-+++ b/.github/workflows/main.yml
-@@ -78,7 +78,7 @@ jobs:
+Index: pytest-6.2.5/.github/workflows/main.yml
+===================================================================
+--- pytest-6.2.5.orig/.github/workflows/main.yml
++++ pytest-6.2.5/.github/workflows/main.yml
+@@ -75,7 +75,7 @@ jobs:
              os: windows-latest
              tox_env: "py39-xdist"
            - name: "windows-py310"
@@ -25,7 +25,7 @@
              os: windows-latest
              tox_env: "py310-xdist"
  
-@@ -108,7 +108,7 @@ jobs:
+@@ -105,7 +105,7 @@ jobs:
              os: ubuntu-latest
              tox_env: "py39-xdist"
            - name: "ubuntu-py310"
@@ -34,11 +34,11 @@
              os: ubuntu-latest
              tox_env: "py310-xdist"
            - name: "ubuntu-pypy3"
-diff --git a/testing/test_skipping.py b/testing/test_skipping.py
-index a0b5cddabc..3010943607 100644
---- a/testing/test_skipping.py
-+++ b/testing/test_skipping.py
-@@ -1143,8 +1143,6 @@ def test_func():
+Index: pytest-6.2.5/testing/test_skipping.py
+===================================================================
+--- pytest-6.2.5.orig/testing/test_skipping.py
++++ pytest-6.2.5/testing/test_skipping.py
+@@ -1126,8 +1126,6 @@ def test_errors_in_xfail_skip_expression
      pypy_version_info = getattr(sys, "pypy_version_info", None)
      if pypy_version_info is not None and pypy_version_info < (6,):
          markline = markline[5:]

Reply via email to