Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-asv-runner for 
openSUSE:Factory checked in at 2026-11-21 21:46:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-asv-runner (Old)
 and      /work/SRC/openSUSE:Factory/.python-asv-runner.new.1340718 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-asv-runner"

Sat Nov 21 21:46:58 2026 rev:4 rq:1399548 version:0.3.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-asv-runner/python-asv-runner.changes      
2026-09-02 17:02:48.656459155 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-asv-runner.new.1340718/python-asv-runner.changes
 2026-11-21 21:48:51.171311522 +0100
@@ -1,0 +2,9 @@
+Fri Nov 20 20:36:37 UTC 2026 - Dirk Müller <[email protected]>
+
+- update to 0.3.2:
+  * Benchmark classes can now carry arbitrary user-defined
+    attributes, which are collected onto the benchmark instance
+    (#55, thanks @hominhquan). This unblocks `higher_is_better`
+    for `track_*` benchmarks in asv (asv#1621).
+
+-------------------------------------------------------------------

Old:
----
  asv_runner-0.3.1.tar.gz

New:
----
  asv_runner-0.3.2.tar.gz

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

Other differences:
------------------
++++++ python-asv-runner.spec ++++++
--- /var/tmp/diff_new_pack.CJ8654/_old  2026-11-21 21:48:51.816338560 +0100
+++ /var/tmp/diff_new_pack.CJ8654/_new  2026-11-21 21:48:51.817338602 +0100
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-asv-runner
-Version:        0.3.1
+Version:        0.3.2
 Release:        0
 Summary:        Core Python benchmark code for ASV
 License:        BSD-3-Clause

++++++ asv_runner-0.3.1.tar.gz -> asv_runner-0.3.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asv_runner-0.3.1/PKG-INFO 
new/asv_runner-0.3.2/PKG-INFO
--- old/asv_runner-0.3.1/PKG-INFO       1970-01-01 01:00:00.000000000 +0100
+++ new/asv_runner-0.3.2/PKG-INFO       1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: asv_runner
-Version: 0.3.1
+Version: 0.3.2
 Summary: Core Python benchmark code for ASV
 Author-Email: Rohit Goswami <[email protected]>, Michael Droettboom <[email protected]>
 Maintainer-Email: Rohit Goswami <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asv_runner-0.3.1/asv_runner/__init__.py 
new/asv_runner-0.3.2/asv_runner/__init__.py
--- old/asv_runner-0.3.1/asv_runner/__init__.py 2026-08-15 20:19:26.489605400 
+0200
+++ new/asv_runner-0.3.2/asv_runner/__init__.py 2026-10-16 22:05:40.055726300 
+0200
@@ -1 +1 @@
-__version__ = '0.3.1'
\ No newline at end of file
+__version__ = '0.3.2'
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asv_runner-0.3.1/asv_runner/benchmarks/_base.py 
new/asv_runner-0.3.2/asv_runner/benchmarks/_base.py
--- old/asv_runner-0.3.1/asv_runner/benchmarks/_base.py 2026-08-15 
20:19:21.474755300 +0200
+++ new/asv_runner-0.3.2/asv_runner/benchmarks/_base.py 2026-10-16 
22:05:37.335266400 +0200
@@ -575,9 +575,30 @@
         # Exported parameter representations
         self.params = _unique_param_ids(self._params)
 
+        # Collect all remaining user-defined attribute (if any)
+        self._collect_dynamic_attrs(func)
+
     def __repr__(self):
         return f"<{self.__class__.__name__} {self.name}>"
 
+    def _collect_dynamic_attrs(self, func):
+        """
+        Capture remaining dynamic user-defined attributes in func
+        """
+        # already-set attrs: name, func, type, unit
+        already_set = set(vars(self))
+        for attr_name, value in getattr(func, "__dict__", {}).items():
+            if (
+                attr_name.startswith("_")
+                or attr_name in already_set
+                or hasattr(type(self), attr_name)
+                or callable(value)
+            ):
+                # ignore all: internal, already-set attributes or callable 
method
+                continue
+            # here should be a user-defined attribute
+            setattr(self, attr_name, value)
+
     def set_param_idx(self, param_idx):
         """
         Set the current parameter values for the benchmark based on a parameter
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asv_runner-0.3.1/pyproject.toml 
new/asv_runner-0.3.2/pyproject.toml
--- old/asv_runner-0.3.1/pyproject.toml 2026-08-15 20:19:26.493543000 +0200
+++ new/asv_runner-0.3.2/pyproject.toml 2026-10-16 22:05:40.058647400 +0200
@@ -28,7 +28,7 @@
 requires-python = ">=3.7"
 readme = "README.md"
 dynamic = []
-version = "0.3.1"
+version = "0.3.2"
 
 [project.license]
 text = "BSD-3-Clause"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/asv_runner-0.3.1/tests/test_dynamic_attrs.py 
new/asv_runner-0.3.2/tests/test_dynamic_attrs.py
--- old/asv_runner-0.3.1/tests/test_dynamic_attrs.py    1970-01-01 
01:00:00.000000000 +0100
+++ new/asv_runner-0.3.2/tests/test_dynamic_attrs.py    2026-10-16 
22:05:37.336769600 +0200
@@ -0,0 +1,66 @@
+"""
+Tests for collection of arbitrary user-defined attributes onto a benchmark
+instance (asv_runner#55).
+"""
+
+import os
+import sys
+import unittest
+
+# Allow running without install: repo root on path
+_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
+if _ROOT not in sys.path:
+    sys.path.insert(0, _ROOT)
+
+from asv_runner.benchmarks.track import TrackBenchmark  # noqa: E402
+
+
+class DummyBenchmarks:
+    """Container standing in for a user's benchmark module/class."""
+
+    def track_mem_bw(self):
+        return 123.4
+
+    track_mem_bw.unit = "MB/s"
+    track_mem_bw.some_boolean = True
+    track_mem_bw._hidden = "should not be copied"
+    track_mem_bw.some_callback = lambda: None
+    track_mem_bw.run = "not a method"
+
+
+class TestDynamicAttrs(unittest.TestCase):
+    def setUp(self):
+        self.instance = DummyBenchmarks()
+        # func first, so _get_first_attr("unit", ...) finds it, mirroring
+        # how real asv discovery builds attr_sources.
+        self.attr_sources = [self.instance.track_mem_bw, self.instance]
+        self.benchmark = TrackBenchmark(
+            "track_mem_bw", self.instance.track_mem_bw, self.attr_sources
+        )
+
+    def test_track_benchmark_constructs(self):
+        # Regression test: constructing a benchmark must not raise, even though
+        # _collect_dynamic_attrs is invoked from __init__ as 
``self._collect_...``.
+        assert self.benchmark.name == "track_mem_bw"
+
+    def test_dynamic_user_attr_lands_on_instance(self):
+        # user-defined, non-callable attribute set on the function is copied 
over
+        assert self.benchmark.some_boolean is True
+
+    def test_existing_attrs_are_not_overwritten(self):
+        # `unit` is resolved by TrackBenchmark via
+        # _get_first_attr(attr_sources, "unit", ...)
+        # *after* Benchmark.__init__ (and thus _collect_dynamic_attrs) has 
already run,
+        # so it must end up as "MB/s", not silently reset to the "unit" 
default.
+        assert self.benchmark.unit == "MB/s"
+
+    def test_callable_and_private_attrs_are_ignored(self):
+        assert not hasattr(self.benchmark, "_hidden")
+        assert not hasattr(self.benchmark, "some_callback")
+
+    def test_class_callable_run_unchanged(self):
+        assert callable(self.benchmark.run)
+
+
+if __name__ == "__main__":
+    unittest.main()

Reply via email to