Skip to content

Fix tests#370

Merged
auscompgeek merged 3 commits into
mainfrom
fix-tests
Jun 22, 2026
Merged

Fix tests#370
auscompgeek merged 3 commits into
mainfrom
fix-tests

Conversation

@auscompgeek

@auscompgeek auscompgeek commented Jun 21, 2026

Copy link
Copy Markdown
Member

=============================== warnings summary ===============================
.venv/lib/python3.14/site-packages/pyfrc/test_support/controller.py:10
  /home/runner/work/pyrebuilt/pyrebuilt/.venv/lib/python3.14/site-packages/pyfrc/test_support/controller.py:10: PytestCollectionWarning: cannot collect test class 'TestController' because it has a __init__ constructor (from: tests/autonomous_test.py)
    class TestController:
@greptile-apps

greptile-apps Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes intermittently failing tests by increasing the robotInit timeout to 3 s, squashes a pytest warning caused by TestController being collected as a test class, and upgrades pytest to resolve a Dependabot alert.

  • tests/autonomous_test.py: re-exports TestController under the alias RobotTestController so pytest no longer tries to collect it as a test class (any class whose name starts with Test is subject to collection under default settings).
  • pyproject.toml: promotes pyfrc to an explicit dev dependency at >=2026.0.3, bumps pytest to >=9.1.1, and adds pyfrc.init_timeout = 3.0 inside [tool.robotpy] to raise the robot initialisation timeout from the 2 s default.
  • uv.lock: reflects the above version bumps and removes the now-unused robotpy-ctre transitive dependency.

Confidence Score: 5/5

All three changes are narrow and well-motivated: a type-alias rename to fix a pytest collection warning, a timeout bump to stop flaky test runs, and routine dependency upgrades with a matching lock file.

The alias rename in the test file is straightforward and correct. The pyfrc.init_timeout key is placed within [tool.robotpy] — consistent with how pyfrc integrates into the robotpy TOML schema — and is gated on the newly pinned pyfrc>=2026.0.3 that introduced the feature. The lock file changes are generated and hash-verified. No logic changes in robot or production code.

No files require special attention.

Important Files Changed

Filename Overview
tests/autonomous_test.py Renames the TestController import to RobotTestController (alias) and updates its usage in the type hint to prevent pytest from collecting it as a test class.
pyproject.toml Adds pyfrc>=2026.0.3 as an explicit dev dependency, bumps pytest to >=9.1.1, and adds pyfrc.init_timeout = 3.0 under [tool.robotpy] to increase the robotInit timeout to 3 seconds.
uv.lock Lock file updated to reflect pyfrc 2026.0.3 and pytest 9.1.1 upgrades; robotpy-ctre removed as it is no longer a transitive dependency.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant pytest
    participant pyfrc plugin
    participant PyFrcPlugin
    participant TestController

    pytest->>pyfrc plugin: collect tests
    pyfrc plugin->>pyfrc plugin: read pyproject.toml\n(pyfrc.init_timeout = 3.0)
    pyfrc plugin->>PyFrcPlugin: instantiate(init_timeout=3.0)
    pytest->>PyFrcPlugin: control fixture
    PyFrcPlugin->>TestController: "TestController(reraise, robot, init_timeout=3.0)"
    TestController->>TestController: wait up to 3s for robotInit
    TestController-->>pytest: control object
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant pytest
    participant pyfrc plugin
    participant PyFrcPlugin
    participant TestController

    pytest->>pyfrc plugin: collect tests
    pyfrc plugin->>pyfrc plugin: read pyproject.toml\n(pyfrc.init_timeout = 3.0)
    pyfrc plugin->>PyFrcPlugin: instantiate(init_timeout=3.0)
    pytest->>PyFrcPlugin: control fixture
    PyFrcPlugin->>TestController: "TestController(reraise, robot, init_timeout=3.0)"
    TestController->>TestController: wait up to 3s for robotInit
    TestController-->>pytest: control object
Loading

Reviews (1): Last reviewed commit: "Update to pytest 9.1.1" | Re-trigger Greptile

@auscompgeek auscompgeek requested a review from rafzip June 21, 2026 05:54
@auscompgeek auscompgeek merged commit c54b9d3 into main Jun 22, 2026
12 checks passed
@auscompgeek auscompgeek deleted the fix-tests branch June 22, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants