#28 Conditionally replace expected test output for Python 3.13 (#2245820)
Closed a month ago by adamwill. Opened a month ago by adamwill.
rpms/ adamwill/sudo py313-test-workaround  into  rawhide

@@ -0,0 +1,9 @@ 

+ Example sudo python plugin will log to /some/not/writable/directory/sudo.log

+ Traceback:

+   File "SRC_DIR/example_io_plugin.py", line 64, in __init__

+     self._open_log_file(path.join(log_path, "sudo.log"))

+     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

+   File "SRC_DIR/example_io_plugin.py", line 134, in _open_log_file

+     self._log_file = open(log_path, "a")

+                      ~~~~^^^^^^^^^^^^^^^

+ 

file modified
+8
@@ -13,6 +13,7 @@ 

  URL: https://www.sudo.ws

  Source0: %{url}/dist/%{name}-%{version}%{?extraver}.tar.gz

  Source1: sudoers

+ Source2: check_example_io_plugin_fails_with_python_backtrace.stdout.py313

  Requires: pam

  Recommends: system-default-editor

  Recommends: %{name}-python-plugin%{?_isa} = %{version}-%{release}
@@ -114,6 +115,13 @@ 

  make

  

  %check

+ %if v"0%{?python3_version}" > v"3.12"

+ # replace the expected output from a test with the correct expected

+ # output for Python 3.13

+ # https://bugzilla.redhat.com/show_bug.cgi?id=2245820

+ # https://github.com/sudo-project/sudo/issues/374

+ cp %{SOURCE2} plugins/python/regress/testdata/check_example_io_plugin_fails_with_python_backtrace.stdout

+ %endif

  make check

  

  %install

This is a bit of a hacky fix for #2245820 because my C isn't good
enough to write a proper upstreamable fix. This file contains
expected output from a test that causes a Python traceback; the
traceback format changed in Python 3.13 so the expected output
doesn't match. We can just replace the expected output file when
the Python version is higher than 3.12.

Signed-off-by: Adam Williamson awilliam@redhat.com

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
https://fedora.softwarefactory-project.io/zuul/buildset/3e395932b1784b04892e1d77b3d461ef

Pull-Request has been closed by adamwill

a month ago