Skip to content

Commit 6cb9ac5

Browse files
committed
fix(about): call guidata's get_python_libs_infos
plotpy.widgets.about.get_python_libs_info and the plotpy-benchmarks header called guidata.widgets.about.get_python_libs_info, which does not exist (renamed by mistake with the "infos" to "info" renaming of PlotPy's own functions), and raised AttributeError. The benchmark header now uses PlotPy's get_python_libs_info, which also gives the version of PlotPy. Refs #89 Assisted-by: Claude Opus 5.5
1 parent 23f3520 commit 6cb9ac5

3 files changed

Lines changed: 39 additions & 3 deletions

File tree

‎plotpy/tests/benchmarks/test_benchmarks.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
import pytest
3636
from guidata.env import execenv
3737
from guidata.qthelpers import qt_app_context
38-
from guidata.widgets import about
3938
from qtpy import QtWidgets as QW
4039

4140
from plotpy.builder import make
4241
from plotpy.plot import PlotOptions, PlotWindow
42+
from plotpy.widgets.about import get_python_libs_info
4343

4444

4545
class BaseBM:
@@ -51,7 +51,7 @@ class BaseBM:
5151
@classmethod
5252
def print_header(cls):
5353
"""Print header for benchmark results"""
54-
execenv.print(f"PlotPy plot benchmark [{about.get_python_libs_info()}]")
54+
execenv.print(f"PlotPy plot benchmark [{get_python_libs_info()}]")
5555
execenv.print()
5656
table_header = (
5757
"N".rjust(10) + " | " + "∆t (ms)".rjust(7) + " | " + "Description"

‎plotpy/tests/unit/test_about.py‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Licensed under the terms of the BSD 3-Clause
4+
# (see plotpy/LICENSE for details)
5+
6+
"""Python and libraries information shown by PlotPy (Issue #89)."""
7+
8+
from __future__ import annotations
9+
10+
import plotpy
11+
from plotpy.tests.benchmarks.test_benchmarks import BaseBM
12+
from plotpy.widgets.about import about, get_python_libs_info
13+
14+
15+
def test_python_libs_info() -> None:
16+
"""The information gives the versions of Python and PlotPy"""
17+
info = get_python_libs_info()
18+
assert info.startswith("Python ")
19+
assert f"PlotPy {plotpy.__version__}" in info
20+
assert f"PlotPy {plotpy.__version__}, extra" in get_python_libs_info("extra")
21+
22+
23+
def test_about_text() -> None:
24+
"""The about text gives the version of PlotPy"""
25+
assert plotpy.__version__ in about(html=False)
26+
27+
28+
def test_benchmark_header() -> None:
29+
"""The benchmark header (`plotpy-benchmarks`) can be printed"""
30+
BaseBM.print_header()
31+
32+
33+
if __name__ == "__main__":
34+
test_python_libs_info()
35+
test_about_text()
36+
test_benchmark_header()

‎plotpy/widgets/about.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def get_python_libs_info(addinfo: str = "") -> str:
3030
if addinfo:
3131
addinfo = ", " + addinfo
3232
addinfo = f"PlotPy {plotpy.__version__}{addinfo}"
33-
return guidata_about.get_python_libs_info(addinfo)
33+
return guidata_about.get_python_libs_infos(addinfo)
3434

3535

3636
def about(html: bool = True, copyright_only: bool = False) -> str:

0 commit comments

Comments
 (0)