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 12:57:28 UTC
(buildstream) branch juerg/update-fixes created (now 393e600e4)
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
at 393e600e4 pytest: Set `testpaths` to fix test collection
This branch includes the following new commits:
new 097a249b3 pluginoriginpip.py: Fix exception name for setuptools 70
new 777021b46 _testing/runcli.py: Use `_yaml.roundtrip_dump()` to work with new ruamel
new 393e600e4 pytest: Set `testpaths` to fix test collection
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.
(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 777021b46b4cea625a9e504cd0e4da86704ed3b1
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 exception name 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 097a249b37ecfc425a84d6c79a81b21e5ccfea6f
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Fri Jul 26 14:36:07 2024 +0200
pluginoriginpip.py: Fix exception name for setuptools 70
---
src/buildstream/_pluginfactory/pluginoriginpip.py | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/buildstream/_pluginfactory/pluginoriginpip.py b/src/buildstream/_pluginfactory/pluginoriginpip.py
index a50534f60..b9f9d2b85 100644
--- a/src/buildstream/_pluginfactory/pluginoriginpip.py
+++ b/src/buildstream/_pluginfactory/pluginoriginpip.py
@@ -32,6 +32,7 @@ class PluginOriginPip(PluginOrigin):
def get_plugin_paths(self, kind, plugin_type):
+ import packaging
import pkg_resources
# Sources and elements are looked up in separate
@@ -62,12 +63,7 @@ class PluginOriginPip(PluginOrigin):
detail=e.report(),
reason="package-version-conflict",
) from e
- except (
- # For setuptools < 49.0.0
- pkg_resources.RequirementParseError,
- # For setuptools >= 49.0.0
- pkg_resources.extern.packaging.requirements.InvalidRequirement,
- ) as e:
+ except packaging.requirements.InvalidRequirement as e:
raise PluginError(
"{}: Malformed package-name '{}' encountered: {}".format(
self.provenance_node.get_provenance(), self._package_name, e
(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 393e600e4de38682087e5e3bc1a706314311e8fe
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 7be278651..594aabbd7 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