Skip to content

[bugfix/testroutine] Pytest-Absturz in der Testroutine behoben (Flake8 entkoppelt)#156

Merged
Schrolli91 merged 2 commits into
BOSWatch:developfrom
KoenigMjr:bugfix/testroutine
Jul 3, 2026
Merged

[bugfix/testroutine] Pytest-Absturz in der Testroutine behoben (Flake8 entkoppelt)#156
Schrolli91 merged 2 commits into
BOSWatch:developfrom
KoenigMjr:bugfix/testroutine

Conversation

@KoenigMjr

Copy link
Copy Markdown
Contributor

Problem

Die CI-Pipeline ist aufgrund einer Inkompatibilität zwischen neueren pytest-Versionen (v8+) und den veralteten Plugins pytest-flake8 / pytest-flakes fehlgeschlagen. Da diese Plugins nicht mehr aktiv gepflegt werden, kam es beim Starten der Tests zu folgendem Validierungsfehler:

pluggy._manager.PluginValidationError: Plugin 'flake8' for hook 'pytest_collect_file'
hookimpl definition: pytest_collect_file(file_path, path, parent)
Argument(s) {'path'} are declared in the hookimpl but can not be found in the hookspec
Error: Process completed with exit code 1.

- Removed deprecated `pytest-flake8` and `pytest-flakes` plugins from requirements.txt.
- Updated `test/pytest.ini` to remove `--flake8` and `--flakes` flags, preventing `PluginValidationError` in pytest 8+.
- Moved flake8 linting into a dedicated step in the GitHub Actions workflow.
- Upgraded checkout and setup-python actions to v4/v5.
@Schrolli91

Copy link
Copy Markdown
Member

Aber wie testet man das nun lokal? Gibt's da eine sinnvolle Lösung?

@KoenigMjr

Copy link
Copy Markdown
Contributor Author

Gute Frage, wie immer!

Ich hab mir bei VSCodium (bzw. VSCode) nicht anders zu helfen gewusst, als einfach die Flake8 Erweiterung zu installieren und die Argumente dort zu hinterlegen.

Was bei mir einfach ist, weil ich die Regeln einfach global für alles beibehalte.
Wenn man Projektspezifische Ignore-Rules hat, weiß ich leider nicht wie man das bewerkstelligen sollte.

Ich mach mich mal schlau und melde mich mit dem Ergebnis.

@KoenigMjr

Copy link
Copy Markdown
Contributor Author

also hab mir das mal bisschen zu gemüte geführt...

tatsächlich wäre der testlauf via terminal etwas umständlich:

flake8 . --extend-ignore=E402,E501,E722,W504,W605 && pytest -c 'test/pytest.ini'

Lösungsvorschlag:

Anlage einer .flake8-Datei im root mit dem Inhalt:

[flake8]
extend-ignore = E402, E501, E722, W504, W605

Dann schrumpft der Schritt in der run_pytest.yml auf:

- name: Run Flake8
      run: |
        flake8 .

und der befehl wäre dann:

flake8 . && pytest -c 'test/pytest.ini'

Frage: Gefällt die Lösung & Durchführen? :)

@Schrolli91

Schrolli91 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Mir ist die exakte Lösung fast egal - aber deinen letzten Vorschlag finde ich ganz gut.
Cool fände ich allerdings, wenn man die Dinge in VS Code Tasks verpackt (.vscode/tasks.json).

Dann kann man das wenigstens einfach aus der IDE heraus ausführen.

…tability

- Add Makefile as single point of truth for environment setup, linting, and testing
- Add self-documenting help menu to Makefile for internationalized developer onboarding
- Add .vscode/tasks.json to bridge VS Code build shortcuts (Ctrl+Shift+B) with Makefile targets
- Add .flake8 configuration to standardize code linting exclusions
- Fix .gitignore to consistently exclude local IDE metadata and virtual environments
- Implement @pytest.mark.skipif in network tests to prevent local execution hangs
- Configure GitHub Actions to run network tests exclusively in CI via RUN_NETWORK_TESTS env variable
@KoenigMjr

Copy link
Copy Markdown
Contributor Author

So, jetzt ist der ganze Spaß ein bisschen ausgeartet... 😉

Was wurde verändert:

  • Das Makefile als Gehirn: Ich habe ein zentrales Makefile hinzugefügt. Es ist der Single Point of Truth für das gesamte Setup – ein einfaches make install richtet das .venv ein und installiert die Requirements. Tippt man nur make, erscheint ein selbsterklärendes Help-Menü.
  • Die .vscode/tasks.json: Um Redundanzen zu vermeiden, steuern die VS Code Tasks jetzt einfach das Makefile an.
  • Shortcut: den Haupt-Check (make check, der erst lint und dann test ausführt) als Standard-Build-Task in VS Code hinterlegt. Im Editor nur noch Strg + Umschalt + B drücken, und das gesamte Projekt wird validiert.
  • Die restliche Hygiene: Der Netzwerk-Test blockiert lokal dank @pytest.mark.skipif nicht mehr, läuft in der GitHub Actions CI (via Env-Variable) aber weiterhin voll durch. .gitignore und .flake8 sind ebenfalls sauber aufgeräumt.

Comment thread test/boswatch/test_broadcast.py

@Schrolli91 Schrolli91 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Schrolli91 Schrolli91 merged commit 38e1106 into BOSWatch:develop Jul 3, 2026
7 checks passed
@KoenigMjr KoenigMjr deleted the bugfix/testroutine branch July 3, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants