Skip to content

check_example_io_plugin_fails_with_python_backtrace fails with Python 3.13 due to changed backtrace format #374

@AdamWill

Description

@AdamWill

Python 3.13 changes the backtrace format, so instead of what the test expects to see:

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")

We get this:

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")
                     ~~~~^^^^^^^^^^^^^^^

There are two obvious ways to deal with this - expect different output for Python 3.13+ and Python <= 3.12, or drop the lines containing only ~, ^ and whitespace characters before doing the comparison - but I'm not much of a C coder so I don't know how to do the second off the top of my head (I will try and figure it out, though), and I don't know if there's a 'standard' way of checking the Python version that we should use if going down that path...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions