Skip to content

Three doctests fail with Python 3.13 #13013

Closed
@penguinpee

Description

@penguinpee

Description of the problem

While updating MNE to version 1.8.0 for Fedora, I ran into three failing tests using Python 3.13 - the default in Fedora 41+.

Those tests succeed when run with Python 3.12.

Steps to reproduce

python3.13 -m pytest -v -m 'not (slowtest or pgtest)' -W ignore::DeprecationWarning

Link to data

No response

Expected results

Tests succeed regardless of Python version. Python 3.13 has officially launched now. I noticed that it has not been added to the CI matrix yet.

Actual results

=================================== FAILURES ===================================
______________________ [doctest] mne.utils.docs.copy_doc _______________________
5093 >>> class A:
5094 ...     def m1():
5095 ...         '''Docstring for m1'''
5096 ...         pass
5097 >>> class B (A):
5098 ...     @copy_doc(A.m1)
5099 ...     def m1():
5100 ...         ''' this gets appended'''
5101 ...         pass
5102 >>> print(B.m1.__doc__)
Expected:
    Docstring for m1 this gets appended
Got:
    Docstring for m1this gets appended
/builddir/build/BUILD/python-mne-1.8.0-build/mne-python-1.8.0/mne/utils/docs.py:5102: DocTestFailure
___________ [doctest] mne.utils.docs.copy_function_doc_to_method_doc ___________
5162 >>> class A:
5163 ...     @copy_function_doc_to_method_doc(plot_function)
5164 ...     def plot(self, a, b):
5165 ...         '''
5166 ...         Notes
5167 ...         -----
5168 ...         .. versionadded:: 0.13.0
5169 ...         '''
5170 ...         plot_function(self, a, b)
5171 >>> print(A.plot.__doc__)
Differences (unified diff with -expected +actual):
    @@ -1,13 +1,13 @@
     Docstring for plotting function.
     <BLANKLINE>
    -    Parameters
    -    ----------
    -    a : int
    -        Some parameter
    -    b : int
    -        Some parameter
    +Parameters
    +----------
    +a : int
    +    Some parameter
    +b : int
    +    Some parameter
     <BLANKLINE>
    -        Notes
    -        -----
    -        .. versionadded:: 0.13.0
    +Notes
    +-----
    +.. versionadded:: 0.13.0
     <BLANKLINE>
/builddir/build/BUILD/python-mne-1.8.0-build/mne-python-1.8.0/mne/utils/docs.py:5171: DocTestFailure
_____________________ test_copy_function_doc_to_method_doc _____________________
mne/utils/tests/test_docs.py:196: in test_copy_function_doc_to_method_doc
    assert (
E   AssertionError: assert 'Docstring fo...Parameter b\n' == 'Docstring fo...r b\n        '
E     
E       Docstring for f1.
E       
E     + Parameters
E     + ----------
E     + a : int
E     -         Parameters...
E     
E     ...Full output truncated (12 lines hidden), use '-vv' to show

Additional information

Platform Linux-6.11.7-100.fc39.x86_64-x86_64-with-glibc2.40.9000
Python 3.13.0 (main, Oct 8 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-4)]
Executable /usr/bin/python3
CPU (8 cores)
Memory Unavailable (requires "psutil" package)
Core
├☑ mne 1.8.0 (unable to check for latest version on GitHub, unknown error: <urlopen error [Errno -3] Temporary failure in name resolution>)
├☑ numpy 1.26.4 (OpenBLAS 0.3.28 with 8 threads)
├☑ scipy 1.14.1
└☑ matplotlib 3.9.1 (backend=agg)

Numerical (optional)
├☑ sklearn 1.5.2
├☑ nibabel 5.3.2
├☑ nilearn 0.11.0
├☑ dipy 1.9.0
├☑ pandas 2.2.1
├☑ h5io 0.2.4
├☑ h5py 3.12.1
└☐ unavailable numba, openmeeg, cupy

Visualization (optional)
├☑ vtk 9.2.6
└☐ unavailable pyvista, pyvistaqt, qtpy, ipympl, pyqtgraph, mne-qt-browser, ipywidgets, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)
└☐ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions