Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing return type hints for Figure #25607

Merged
merged 1 commit into from
Apr 29, 2023

Missing return types for Figure

8edf04f
Select commit
Failed to load commit list.
Merged

Missing return type hints for Figure #25607

Missing return types for Figure
8edf04f
Select commit
Failed to load commit list.
Azure Pipelines / matplotlib.matplotlib failed Apr 27, 2023 in 1h 22m 7s

Build #20230427.20 had test failures

Details

Tests

  • Failed: 13 (0.02%)
  • Passed: 75,229 (89.27%)
  • Other: 9,028 (10.71%)
  • Total: 84,270

Annotations

Check failure on line 3054 in Build log

See this annotation in the file changed.

@azure-pipelines azure-pipelines / matplotlib.matplotlib

Build log #L3054

Bash exited with code '1'.

Check failure on line 1 in test_blit

See this annotation in the file changed.

@azure-pipelines azure-pipelines / matplotlib.matplotlib

test_blit

Failed: Subprocess failed to test intended behavior
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/runner/work/1/s/lib/matplotlib/tests/test_backend_tk.py", line 77, in test_blit
    fig, ax = plt.subplots()
  File "/Users/runner/work/1/s/lib/matplotlib/pyplot.py", line 1562, in subplots
    fig = figure(**fig_kw)
  File "/Users/runner/work/1/s/lib/matplotlib/pyplot.py", line 898, in figure
    manager = new_figure_manager(
  File "/Users/runner/work/1/s/lib/matplotlib/pyplot.py", line 429, in new_figure_manager
    return _get_backend_mod().new_figure_manager(*args, **kwargs)
  File "/Users/runner/work/1/s/lib/matplotlib/backend_bases.py", line 3388, in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
  File "/Users/runner/work/1/s/lib/matplotlib/backend_bases.py", line 3393, in new_figure_manager_given_figure
    return cls.FigureCanvas.new_manager(figure, num)
  File "/Users/runner/work/1/s/lib/matplotlib/backend_bases.py", line 1779, in new_manager
    return cls.manager_class.create_with_canvas(cls, figure, num)
  File "/Users/runner/work/1/s/lib/matplotlib/backends/_backend_tk.py", line 486, in create_with_canvas
    window = tk.Tk(className="matplotlib")
  File "/Users/runner/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/tkinter/__init__.py", line 2301, in __init__
    self._loadtk()
  File "/Users/runner/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/tkinter/__init__.py", line 2317, in _loadtk
    raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)"
RuntimeError: tk.h version (8.5) doesn't match libtk.a version (8.6)
Raw output
@pytest.mark.skipif(
        not importlib.util.find_spec('tkinter'),
        reason="missing tkinter"
    )
    @pytest.mark.skipif(
        sys.platform == "linux" and not _c_internal_utils.display_is_valid(),
        reason="$DISPLAY and $WAYLAND_DISPLAY are unset"
    )
    @functools.wraps(func)
    def test_func():
        # even if the package exists, may not actually be importable this can
        # be the case on some CI systems.
        pytest.importorskip('tkinter')
        try:
>           proc = subprocess_run_helper(
                func, timeout=_test_timeout, extra_env=dict(
                    MPLBACKEND="TkAgg", MPL_TEST_ESCAPE_HATCH="1"))

lib/matplotlib/tests/test_backend_tk.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

func = <function test_blit at 0x112996b90>, timeout = 60
extra_env = {'MPLBACKEND': 'TkAgg', 'MPL_TEST_ESCAPE_HATCH': '1'}, args = ()
target = 'test_blit'

    def subprocess_run_helper(func, *args, timeout, extra_env=None):
        """
        Run a function in a sub-process.
    
        Parameters
        ----------
        func : function
            The function to be run.  It must be in a module that is importable.
        *args : str
            Any additional command line arguments to be passed in
            the first argument to ``subprocess.run``.
        extra_env : dict[str, str]
            Any additional environment variables to be set for the subprocess.
        """
        target = func.__name__
        module = func.__module__
>       proc = subprocess_run_for_testing(
            [
                sys.executable,
                "-c",
                f"from {module} import {target}; {target}()",
                *args
            ],
            env={**os.environ, "SOURCE_DATE_EPOCH": "0", **(extra_env or {})},
            timeout=timeout, check=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            text=True
        )

lib/matplotlib/testing/__init__.py:132: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

command = ['/Users/runner/hostedtoolcache/Python/3.10.11/x64/bin/python', '-c', 'from matplotlib.tests.test_backend_tk import test_blit; test_blit()']
env = {'AGENT_ACCEPTTEEEULA': 'True', 'AGENT_BUILDDIRECTORY': '/Users/runner/work/1', 'AGENT_CLOUDID': 'cd56b78d-2d0a-450a-ae88-becb7cc2a597', 'AGENT_DISABLELOGPLUGIN_TESTFILEPUBLISHERPLUGIN': 'true', ...}
timeout = 60, stdout = -1, stderr = -1, check = True, text = True
capture_output = False

    def subprocess_run_for_testing(
            command: "list[str]",
            env: "dict[str, str]" = None,
            timeout: float = None,
            stdout=None,
            stderr=None,
            check: bool = False,
            text: bool = True,
            capture_output: bool = False
    ) -> "subprocess.Popen":
        """
        Create and run a subprocess.
    
        Thin wrapper around `subprocess.run`, intended for testing.  Will
        mark fork() failures on Cygwin as expected failures: not a
        success, but not indicating a problem with the code either.
    
        Parameters
        ----------
        args : list of str
        env : dict[str, str]
        timeout : float
        stdout, stderr
        check : bool
        text : bool
            Also called ``universal_newlines`` in subprocess.  I chose this
            name since the main effect is returning bytes (`False`) vs. str
            (`True`), though it also tries to normalize newlines across
            platforms.
        capture_output : bool
            Set stdout and stderr to subprocess.PIPE
    
        Returns
        -------
        proc : subprocess.Popen
    
        See Also
        --------
        subprocess.run
    
        Raises
        ------
        pytest.xfail
            If platform is Cygwin and subprocess reports a fork() failure.
        """
        if capture_output:
            stdout = stderr = subp

Check failure on line 1 in test_figuremanager_preserves_host_mainloop

See this annotation in the file changed.

@azure-pipelines azure-pipelines / matplotlib.matplotlib

test_figuremanager_preserves_host_mainloop

Failed: Subprocess failed to test intended behavior
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/runner/work/1/s/lib/matplotlib/tests/test_backend_tk.py", line 118, in test_figuremanager_preserves_host_mainloop
    root = tkinter.Tk()
  File "/Users/runner/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/tkinter/__init__.py", line 2301, in __init__
    self._loadtk()
  File "/Users/runner/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/tkinter/__init__.py", line 2317, in _loadtk
    raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)"
RuntimeError: tk.h version (8.5) doesn't match libtk.a version (8.6)
Raw output
@pytest.mark.skipif(
        not importlib.util.find_spec('tkinter'),
        reason="missing tkinter"
    )
    @pytest.mark.skipif(
        sys.platform == "linux" and not _c_internal_utils.display_is_valid(),
        reason="$DISPLAY and $WAYLAND_DISPLAY are unset"
    )
    @functools.wraps(func)
    def test_func():
        # even if the package exists, may not actually be importable this can
        # be the case on some CI systems.
        pytest.importorskip('tkinter')
        try:
>           proc = subprocess_run_helper(
                func, timeout=_test_timeout, extra_env=dict(
                    MPLBACKEND="TkAgg", MPL_TEST_ESCAPE_HATCH="1"))

lib/matplotlib/tests/test_backend_tk.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

func = <function test_figuremanager_preserves_host_mainloop at 0x112996d40>
timeout = 60, extra_env = {'MPLBACKEND': 'TkAgg', 'MPL_TEST_ESCAPE_HATCH': '1'}
args = (), target = 'test_figuremanager_preserves_host_mainloop'

    def subprocess_run_helper(func, *args, timeout, extra_env=None):
        """
        Run a function in a sub-process.
    
        Parameters
        ----------
        func : function
            The function to be run.  It must be in a module that is importable.
        *args : str
            Any additional command line arguments to be passed in
            the first argument to ``subprocess.run``.
        extra_env : dict[str, str]
            Any additional environment variables to be set for the subprocess.
        """
        target = func.__name__
        module = func.__module__
>       proc = subprocess_run_for_testing(
            [
                sys.executable,
                "-c",
                f"from {module} import {target}; {target}()",
                *args
            ],
            env={**os.environ, "SOURCE_DATE_EPOCH": "0", **(extra_env or {})},
            timeout=timeout, check=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            text=True
        )

lib/matplotlib/testing/__init__.py:132: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

command = ['/Users/runner/hostedtoolcache/Python/3.10.11/x64/bin/python', '-c', 'from matplotlib.tests.test_backend_tk import test_figuremanager_preserves_host_mainloop; test_figuremanager_preserves_host_mainloop()']
env = {'AGENT_ACCEPTTEEEULA': 'True', 'AGENT_BUILDDIRECTORY': '/Users/runner/work/1', 'AGENT_CLOUDID': 'cd56b78d-2d0a-450a-ae88-becb7cc2a597', 'AGENT_DISABLELOGPLUGIN_TESTFILEPUBLISHERPLUGIN': 'true', ...}
timeout = 60, stdout = -1, stderr = -1, check = True, text = True
capture_output = False

    def subprocess_run_for_testing(
            command: "list[str]",
            env: "dict[str, str]" = None,
            timeout: float = None,
            stdout=None,
            stderr=None,
            check: bool = False,
            text: bool = True,
            capture_output: bool = False
    ) -> "subprocess.Popen":
        """
        Create and run a subprocess.
    
        Thin wrapper around `subprocess.run`, intended for testing.  Will
        mark fork() failures on Cygwin as expected failures: not a
        success, but not indicating a problem with the code either.
    
        Parameters
        ----------
        args : list of str
        env : dict[str, str]
        timeout : float
        stdout, stderr
        check : bool
        text : bool
            Also called ``universal_newlines`` in subprocess.  I chose this
            name since the main effect is returning bytes (`False`) vs. str
            (`True`), though it also tries to normalize newlines across
            platforms.
        capture_output : bool
            Set stdout and stderr to subprocess.PIPE
    
        Returns
        -------
        proc : subprocess.Popen
    
        See Also
        --------
        subprocess.run
    
        Raises
        ------
        pytest.xfail
            If p

Check failure on line 1 in test_figuremanager_cleans_own_mainloop

See this annotation in the file changed.

@azure-pipelines azure-pipelines / matplotlib.matplotlib

test_figuremanager_cleans_own_mainloop

Failed: Subprocess failed to test intended behavior
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/runner/work/1/s/lib/matplotlib/tests/test_backend_tk.py", line 138, in test_figuremanager_cleans_own_mainloop
    root = tkinter.Tk()
  File "/Users/runner/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/tkinter/__init__.py", line 2301, in __init__
    self._loadtk()
  File "/Users/runner/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/tkinter/__init__.py", line 2317, in _loadtk
    raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)"
RuntimeError: tk.h version (8.5) doesn't match libtk.a version (8.6)
Raw output
@pytest.mark.skipif(
        not importlib.util.find_spec('tkinter'),
        reason="missing tkinter"
    )
    @pytest.mark.skipif(
        sys.platform == "linux" and not _c_internal_utils.display_is_valid(),
        reason="$DISPLAY and $WAYLAND_DISPLAY are unset"
    )
    @functools.wraps(func)
    def test_func():
        # even if the package exists, may not actually be importable this can
        # be the case on some CI systems.
        pytest.importorskip('tkinter')
        try:
>           proc = subprocess_run_helper(
                func, timeout=_test_timeout, extra_env=dict(
                    MPLBACKEND="TkAgg", MPL_TEST_ESCAPE_HATCH="1"))

lib/matplotlib/tests/test_backend_tk.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

func = <function test_figuremanager_cleans_own_mainloop at 0x112996e60>
timeout = 60, extra_env = {'MPLBACKEND': 'TkAgg', 'MPL_TEST_ESCAPE_HATCH': '1'}
args = (), target = 'test_figuremanager_cleans_own_mainloop'

    def subprocess_run_helper(func, *args, timeout, extra_env=None):
        """
        Run a function in a sub-process.
    
        Parameters
        ----------
        func : function
            The function to be run.  It must be in a module that is importable.
        *args : str
            Any additional command line arguments to be passed in
            the first argument to ``subprocess.run``.
        extra_env : dict[str, str]
            Any additional environment variables to be set for the subprocess.
        """
        target = func.__name__
        module = func.__module__
>       proc = subprocess_run_for_testing(
            [
                sys.executable,
                "-c",
                f"from {module} import {target}; {target}()",
                *args
            ],
            env={**os.environ, "SOURCE_DATE_EPOCH": "0", **(extra_env or {})},
            timeout=timeout, check=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            text=True
        )

lib/matplotlib/testing/__init__.py:132: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

command = ['/Users/runner/hostedtoolcache/Python/3.10.11/x64/bin/python', '-c', 'from matplotlib.tests.test_backend_tk import test_figuremanager_cleans_own_mainloop; test_figuremanager_cleans_own_mainloop()']
env = {'AGENT_ACCEPTTEEEULA': 'True', 'AGENT_BUILDDIRECTORY': '/Users/runner/work/1', 'AGENT_CLOUDID': 'cd56b78d-2d0a-450a-ae88-becb7cc2a597', 'AGENT_DISABLELOGPLUGIN_TESTFILEPUBLISHERPLUGIN': 'true', ...}
timeout = 60, stdout = -1, stderr = -1, check = True, text = True
capture_output = False

    def subprocess_run_for_testing(
            command: "list[str]",
            env: "dict[str, str]" = None,
            timeout: float = None,
            stdout=None,
            stderr=None,
            check: bool = False,
            text: bool = True,
            capture_output: bool = False
    ) -> "subprocess.Popen":
        """
        Create and run a subprocess.
    
        Thin wrapper around `subprocess.run`, intended for testing.  Will
        mark fork() failures on Cygwin as expected failures: not a
        success, but not indicating a problem with the code either.
    
        Parameters
        ----------
        args : list of str
        env : dict[str, str]
        timeout : float
        stdout, stderr
        check : bool
        text : bool
            Also called ``universal_newlines`` in subprocess.  I chose this
            name since the main effect is returning bytes (`False`) vs. str
            (`True`), though it also tries to normalize newlines across
            platforms.
        capture_output : bool
            Set stdout and stderr to subprocess.PIPE
    
        Returns
        -------
        proc : subprocess.Popen
    
        See Also
        --------
        subprocess.run
    
        Raises
        ------
        pytest.xfail
            If platform is Cygwi

Check failure on line 1 in test_never_update

See this annotation in the file changed.

@azure-pipelines azure-pipelines / matplotlib.matplotlib

test_never_update

Failed: Subprocess failed to test intended behavior
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/runner/work/1/s/lib/matplotlib/tests/test_backend_tk.py", line 165, in test_never_update
    fig = plt.figure()
  File "/Users/runner/work/1/s/lib/matplotlib/pyplot.py", line 898, in figure
    manager = new_figure_manager(
  File "/Users/runner/work/1/s/lib/matplotlib/pyplot.py", line 429, in new_figure_manager
    return _get_backend_mod().new_figure_manager(*args, **kwargs)
  File "/Users/runner/work/1/s/lib/matplotlib/backend_bases.py", line 3388, in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
  File "/Users/runner/work/1/s/lib/matplotlib/backend_bases.py", line 3393, in new_figure_manager_given_figure
    return cls.FigureCanvas.new_manager(figure, num)
  File "/Users/runner/work/1/s/lib/matplotlib/backend_bases.py", line 1779, in new_manager
    return cls.manager_class.create_with_canvas(cls, figure, num)
  File "/Users/runner/work/1/s/lib/matplotlib/backends/_backend_tk.py", line 486, in create_with_canvas
    window = tk.Tk(className="matplotlib")
  File "/Users/runner/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/tkinter/__init__.py", line 2301, in __init__
    self._loadtk()
  File "/Users/runner/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/tkinter/__init__.py", line 2317, in _loadtk
    raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)"
RuntimeError: tk.h version (8.5) doesn't match libtk.a version (8.6)
Raw output
@pytest.mark.skipif(
        not importlib.util.find_spec('tkinter'),
        reason="missing tkinter"
    )
    @pytest.mark.skipif(
        sys.platform == "linux" and not _c_internal_utils.display_is_valid(),
        reason="$DISPLAY and $WAYLAND_DISPLAY are unset"
    )
    @functools.wraps(func)
    def test_func():
        # even if the package exists, may not actually be importable this can
        # be the case on some CI systems.
        pytest.importorskip('tkinter')
        try:
>           proc = subprocess_run_helper(
                func, timeout=_test_timeout, extra_env=dict(
                    MPLBACKEND="TkAgg", MPL_TEST_ESCAPE_HATCH="1"))

lib/matplotlib/tests/test_backend_tk.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

func = <function test_never_update at 0x112996f80>, timeout = 60
extra_env = {'MPLBACKEND': 'TkAgg', 'MPL_TEST_ESCAPE_HATCH': '1'}, args = ()
target = 'test_never_update'

    def subprocess_run_helper(func, *args, timeout, extra_env=None):
        """
        Run a function in a sub-process.
    
        Parameters
        ----------
        func : function
            The function to be run.  It must be in a module that is importable.
        *args : str
            Any additional command line arguments to be passed in
            the first argument to ``subprocess.run``.
        extra_env : dict[str, str]
            Any additional environment variables to be set for the subprocess.
        """
        target = func.__name__
        module = func.__module__
>       proc = subprocess_run_for_testing(
            [
                sys.executable,
                "-c",
                f"from {module} import {target}; {target}()",
                *args
            ],
            env={**os.environ, "SOURCE_DATE_EPOCH": "0", **(extra_env or {})},
            timeout=timeout, check=True,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            text=True
        )

lib/matplotlib/testing/__init__.py:132: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

command = ['/Users/runner/hostedtoolcache/Python/3.10.11/x64/bin/python', '-c', 'from matplotlib.tests.test_backend_tk import test_never_update; test_never_update()']
env = {'AGENT_ACCEPTTEEEULA': 'True', 'AGENT_BUILDDIRECTORY': '/Users/runner/work/1', 'AGENT_CLOUDID': 'cd56b78d-2d0a-450a-ae88-becb7cc2a597', 'AGENT_DISABLELOGPLUGIN_TESTFILEPUBLISHERPLUGIN': 'true', ...}
timeout = 60, stdout = -1, stderr = -1, check = True, text = True
capture_output = False

    def subprocess_run_for_testing(
            command: "list[str]",
            env: "dict[str, str]" = None,
            timeout: float = None,
            stdout=None,
            stderr=None,
            check: bool = False,
            text: bool = True,
            capture_output: bool = False
    ) -> "subprocess.Popen":
        """
        Create and run a subprocess.
    
        Thin wrapper around `subprocess.run`, intended for testing.  Will
        mark fork() failures on Cygwin as expected failures: not a
        success, but not indicating a problem with the code either.
    
        Parameters
        ----------
        args : list of str
        env : dict[str, str]
        timeout : float
        stdout, stderr
        check : bool
        text : bool
            Also called ``universal_newlines`` in subprocess.  I chose this
            name since the main effect is returning bytes (`False`) vs. str
            (`True`), though it also tries to normalize newlines across
            platforms.
        capture_output : bool
            Set stdout and stderr to subprocess.PIPE
    
        Returns
        -------
        proc : subprocess.Popen
    
        See Also
        --------
        subprocess.run
    
        Raises
        ------
        pytest.xfail
            If platform is Cygwin and subprocess reports a fork() failure.
        """
        if capture_output: