From b79e69310a8a28e6f7478653220f0cdf30e8af4b Mon Sep 17 00:00:00 2001 From: "Dr.-Ing. Amilcar do Carmo Lucas" Date: Wed, 25 Jun 2025 14:51:33 +0200 Subject: [PATCH 1/2] ci(pytest): use uv to install pytest environment --- .github/workflows/pytest.yml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index c26f9d63..246be6ff 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -40,25 +40,17 @@ jobs: - name: Checkout uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + # https://docs.astral.sh/uv/guides/integration/github/ + - name: Install uv and set the python version + uses: astral-sh/setup-uv@d9e0f98d3fc6adb07d1e3d37f3043649ddad06a1 # v6.5.0 with: python-version: ${{ matrix.python-version }} - - - name: Set up pip cache - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 - with: - path: | - ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }} - restore-keys: | - ${{ runner.os }}-pip-${{ matrix.python-version }}- - ${{ runner.os }}-pip- + activate-environment: true - name: Install dependencies and application # without --editable the coverage report is not generated correctly run: | - pip install --editable .[dev] + uv pip install --editable .[dev] - name: Test with pytest id: pytest @@ -67,7 +59,7 @@ jobs: export LIBGL_ALWAYS_SOFTWARE=1 export DISPLAY=:99 Xvfb :99 -screen 0 1024x768x16 & - pytest --cov=ardupilot_methodic_configurator --cov-report=xml:tests/coverage.xml --md=tests/results-${{ matrix.python-version }}.md --junit-xml=tests/results-junit.xml + uv run pytest --cov=ardupilot_methodic_configurator --cov-report=xml:tests/coverage.xml --md=tests/results-${{ matrix.python-version }}.md --junit-xml=tests/results-junit.xml - name: Fix coverage paths run: | From 57d2605cacfdf216ea2b4287fbb99a0c24f6aa94 Mon Sep 17 00:00:00 2001 From: "Dr.-Ing. Amilcar do Carmo Lucas" Date: Sun, 17 Aug 2025 19:51:56 +0200 Subject: [PATCH 2/2] fix(rich text): Make the tests less sensitive to env changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Different Tk theme / fontconfig mapping: Tk reports whatever font the current theme gives it. On Linux that often is a logical family like "sans" which fontconfig resolves to a real family (Helvetica, DejaVu Sans, etc.). On another environment (pip vs uv) the system/theme/fontconfig mapping differs, so get_widget_font_family_and_size can return "sans-serif" or "Helvetica". Different display/DPI and unit conventions: Tk reports font "size" as either points (positive) or pixels (negative). Many Linux themes specify pixel sizes (e.g. -12 means 12 pixels). On Windows the theme often uses point sizes (e.g. 9). With a typical DPI (96) 12 px ≈ 9 pt, so the two numbers are consistent in physical size but different numerically and signed. Different runtime environments used by pip and uv: they may run tests under different user/system fonts, different themes, headless vs desktop, or different X11/Wayland/backends — all of which change the default Tk font. --- tests/test_frontend_tkinter_rich_text.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_frontend_tkinter_rich_text.py b/tests/test_frontend_tkinter_rich_text.py index 2afb8c34..7967b8d4 100755 --- a/tests/test_frontend_tkinter_rich_text.py +++ b/tests/test_frontend_tkinter_rich_text.py @@ -77,12 +77,12 @@ def tearDown(self) -> None: def test_get_widget_font_family_and_size(self) -> None: label = ttk.Label(self.root, text="Test") family, size = get_widget_font_family_and_size(label) - expected_family = "Segoe UI" if platform_system() == "Windows" else "sans-serif" - expected_size = 9 if platform_system() == "Windows" else 10 + expected_family = ["Segoe UI"] if platform_system() == "Windows" else ["Helvetica", "sans-serif"] + expected_size = [9] if platform_system() == "Windows" else [-12, 10] assert isinstance(family, str) assert isinstance(size, int) - assert family == expected_family - assert size == expected_size + assert family in expected_family + assert size in expected_size if __name__ == "__main__":