name: Tests on: push: branches: [main] pull_request: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.x" # uv with a cached wheel store installs requirements.txt (git deps # included) in seconds; plain pip took ~26 s of a ~56 s run. - uses: astral-sh/setup-uv@v10.2.0 with: enable-cache: true cache-dependency-glob: requirements.txt cache-suffix: tests - name: Install dependencies run: uv pip install --system -r requirements.txt # The gate's keyboard and layout tests drive real Tk: widget heights and # the focus ring come from the font engine, and no mock can answer what # they ask. Without a display they do not skip -- they fail, which is how # this job stayed red while the tests themselves were fine. pytest-xvfb # (requirements.txt, geometry in pyproject) starts one Xvfb per xdist # worker: a shared display let workers steal each other's focus. # ubuntu-latest already ships xvfb, so the unconditional # `apt-get update && install` spent ~7 s to report "already the newest # version"; it now installs only on an image that lacks it. - name: Install a virtual X display run: | command -v Xvfb >/dev/null \ || { sudo apt-get update && sudo apt-get install -y xvfb; } # -n auto spreads the suite over every runner core (pytest-xdist is in # requirements.txt); pytest-cov merges the workers' coverage and the # 100% bar still comes from pyproject's fail_under. -q because -v # printed all ~1050 test ids. - name: Run tests with coverage run: | python -m pytest \ -n auto \ -p no:sugar \ -q