Whole file

robotframework/robotframework

The author described this change as Fix precision issues with listener priority. It counts as a record because the checks below fail on the code as it stood at 6ca3aae8d and pass on b6f50b2b5, with nothing else changed between the two runs.

Fix saved2026-03-19
Sharing licenceApache-2.0 · LICENSE.txt
Change size+8 3

What the code was meant to do, written into the code itself as a save note

Fix precision issues with listener priority

The change

2626
2727 from .logger import LOGGER
2828 from .loggerapi import LoggerApi
29-from .loglevel import LogLevel
29+from .loglevel import LogLevel, SettableLevel
3030
3131
3232 class Listeners:
3535 def __init__(
3636 self,
3737 listeners: Iterable["str|Any"] = (),
38- log_level: "LogLevel|str" = "INFO",
38+ log_level: "LogLevel|SettableLevel" = "INFO",
3939 ):
4040 if isinstance(log_level, str):
4141 log_level = LogLevel(log_level)
137137
138138 def _get_priority(self, listener):
139139 priority = getattr(listener, "ROBOT_LISTENER_PRIORITY", 0)
140+ if isinstance(priority, (int, float)):
141+ return priority
140142 try:
141- return float(priority)
143+ try:
144+ return int(priority)
145+ except ValueError:
146+ return float(priority)
142147 except (ValueError, TypeError):
143148 raise DataError(f"Invalid listener priority '{priority}'.")
144149

The check that tells the two apart

failpass·utest/output/test_listeners.py::TestListenerPriority::test_huge_priority
failpass·utest/output/test_listeners.py::TestListenerPriority::test_no_priority
failpass·utest/output/test_listeners.py::TestListenerPriority::test_priority

Check file utest/output/test_listeners.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it6ca3aae8d8ee49e52cc16b31de63243ea4a59ae2
Broken version dated2026-03-17
Modulerobot.output.listeners
Units changedListenerFacade, Listeners
Fingerprint176560798c094877
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in robotframework/robotframework