You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ju...@apache.org on 2024/07/26 14:06:16 UTC

(buildstream) branch juerg/update-fixes updated (78159cf19 -> 52b7212ac)

This is an automated email from the ASF dual-hosted git repository.

juergbi pushed a change to branch juerg/update-fixes
in repository https://gitbox.apache.org/repos/asf/buildstream.git


 discard 78159cf19 pytest: Set `testpaths` to fix test collection
 discard 5604360cb _testing/runcli.py: Use `_yaml.roundtrip_dump()` to work with new ruamel
 discard 5d917f306 pluginoriginpip.py: Fix error type for setuptools 70
     new 4ef82cdba pluginoriginpip.py: Fix error type for setuptools 70
     new 8df8873e8 _testing/runcli.py: Use `_yaml.roundtrip_dump()` to work with new ruamel
     new 52b7212ac pytest: Set `testpaths` to fix test collection

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (78159cf19)
            \
             N -- N -- N   refs/heads/juerg/update-fixes (52b7212ac)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 setup.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


(buildstream) 02/03: _testing/runcli.py: Use `_yaml.roundtrip_dump()` to work with new ruamel

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juergbi pushed a commit to branch juerg/update-fixes
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 8df8873e8a02d199c1e7c2f829c45681ce3b324f
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Fri Jul 26 14:55:01 2024 +0200

    _testing/runcli.py: Use `_yaml.roundtrip_dump()` to work with new ruamel
    
    `yaml.safe_dump()` has been removed.
---
 src/buildstream/_testing/runcli.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/buildstream/_testing/runcli.py b/src/buildstream/_testing/runcli.py
index 2443e9093..d91e40034 100644
--- a/src/buildstream/_testing/runcli.py
+++ b/src/buildstream/_testing/runcli.py
@@ -549,7 +549,7 @@ class CliIntegration(Cli):
 
                 temp_project = os.path.join(scratchdir, "project.conf")
                 with open(temp_project, "w", encoding="utf-8") as f:
-                    yaml.safe_dump(project_config, f)
+                    _yaml.roundtrip_dump(project_config, f)
 
                 project_config = _yaml.load(temp_project, shortname="project.conf")
 


(buildstream) 01/03: pluginoriginpip.py: Fix error type for setuptools 70

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juergbi pushed a commit to branch juerg/update-fixes
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 4ef82cdba7e0666abf7bb686e3b39e0df2d01374
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Fri Jul 26 14:36:07 2024 +0200

    pluginoriginpip.py: Fix error type for setuptools 70
---
 setup.cfg                                         | 2 +-
 src/buildstream/_pluginfactory/pluginoriginpip.py | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/setup.cfg b/setup.cfg
index 7be278651..63cbbcbb4 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -42,7 +42,7 @@ warn_no_return = True
 
 # Ignore missing stubs for third-party packages.
 # In future, these should be re-enabled if/when stubs for them become available.
-[mypy-copyreg,grpc,pluginbase,psutil,pyroaring,ruamel,multiprocessing.forkserver]
+[mypy-copyreg,grpc,pluginbase,psutil,pyroaring,ruamel,multiprocessing.forkserver,pkg_resources.extern]
 ignore_missing_imports=True
 
 # Ignore issues with generated files and vendored code
diff --git a/src/buildstream/_pluginfactory/pluginoriginpip.py b/src/buildstream/_pluginfactory/pluginoriginpip.py
index a50534f60..542776e0b 100644
--- a/src/buildstream/_pluginfactory/pluginoriginpip.py
+++ b/src/buildstream/_pluginfactory/pluginoriginpip.py
@@ -34,6 +34,13 @@ class PluginOriginPip(PluginOrigin):
 
         import pkg_resources
 
+        try:
+            # For setuptools >= 70
+            import packaging
+        except ImportError:
+            # For setuptools < 70
+            from pkg_resources.extern import packaging
+
         # Sources and elements are looked up in separate
         # entrypoint groups from the same package.
         #
@@ -66,7 +73,7 @@ class PluginOriginPip(PluginOrigin):
             # For setuptools < 49.0.0
             pkg_resources.RequirementParseError,
             # For setuptools >= 49.0.0
-            pkg_resources.extern.packaging.requirements.InvalidRequirement,
+            packaging.requirements.InvalidRequirement,
         ) as e:
             raise PluginError(
                 "{}: Malformed package-name '{}' encountered: {}".format(


(buildstream) 03/03: pytest: Set `testpaths` to fix test collection

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juergbi pushed a commit to branch juerg/update-fixes
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 52b7212ac28c03cfcb352163ecf8834284ce5fc2
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Fri Jul 26 13:24:50 2024 +0200

    pytest: Set `testpaths` to fix test collection
    
    pytest 8 had breaking changes in test collection, which prevented the
    main test suite from being picked up in combination with our
    `sourcetests_collection_hook`.
---
 setup.cfg                            |  1 +
 src/buildstream/_testing/__init__.py | 19 +++----------------
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/setup.cfg b/setup.cfg
index 63cbbcbb4..469e2b257 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -22,6 +22,7 @@ parentdir_prefix = BuildStream-
 
 [tool:pytest]
 addopts = --verbose --basetemp ./tmp --durations=20 --timeout=1800
+testpaths = tests
 norecursedirs = src tests/integration/project tests/plugins/loading tests/plugins/sample-plugins integration-cache tmp __pycache__ .eggs
 python_files = tests/*/*.py
 env =
diff --git a/src/buildstream/_testing/__init__.py b/src/buildstream/_testing/__init__.py
index a7520c819..7fa3643a2 100644
--- a/src/buildstream/_testing/__init__.py
+++ b/src/buildstream/_testing/__init__.py
@@ -100,23 +100,10 @@ def sourcetests_collection_hook(session):
     """
 
     def should_collect_tests(config):
-        args = config.args
-        rootdir = config.rootdir
-        # When no args are supplied, pytest defaults the arg list to
-        # just include the session's root_dir. We want to collect
+        # When no args are supplied, pytest defaults the arg list to the
+        # value of the `testpaths` configuration option. We want to collect
         # tests as part of the default collection
-        if args == [str(rootdir)]:
-            return True
-
-        # If specific tests are passed, don't collect
-        # everything. Pytest will handle this correctly without
-        # modification.
-        if len(args) > 1 or rootdir not in args:
-            return False
-
-        # If in doubt, collect them, this will be an easier bug to
-        # spot and is less likely to result in bug not being found.
-        return True
+        return config.args_source != pytest.Config.ArgsSource.ARGS
 
     from . import _sourcetests