Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Unit Test Generator

Offen
#473 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
django, python
Bereich
backend, testing, tooling

Rechercherichtung

Beginne mit der Durchsicht von project_template und requirements-dev.txt und vergleiche anschließend die beiden vorgeschlagenen Ansätze: einen generischen Test für Modelle auf Basis von CoderedPage oder einen maketests-Management-Command nach dem Vorbild von makemigrations. Bestätige vor der Implementierung den Umfang und die Testwerkzeuge; erledigt ist die Aufgabe, wenn ein dokumentierter, nutzbarer Ausgangspunkt für Modelltests mit Abdeckung des vorgesehenen grundlegenden Verhaltens vorhanden ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Type: Enhancement

As part of the project_template, I think it would be beneficial to also create a template for unit tests, to instantly provide some minimal coverage and to make it as easy as possible for developers to get started writing more advanced tests.

The biggest barrier to entry is often times just setting all the test framework up, and remembering how to do it.

Two ideas here, not necessarily mutually exclusive:

  1. A generic test which loads all known models based on CoderedPage (we already have this list). Loops through them and creates an object with a title and some other basic fields, and asserts a successful GET response. The advantage is that you get free unit tests; the disadvantage is that it would still require writing custom unit tests for actual functionality.

  2. Similar to makemigrations, a management command maketests which creates a boilerplate unit test file for each model that doesn't already have a test file. This would be super easy to implement as it could essentially just copy a python template into the folder. The result would be a basic unit test similar to 1 above, but with the intention that the developer can start customizing it to do more.

As part of this we would also need to provide test tooling in requirements-dev.txt, similar to how the sass template works.

While 1 above is a bit "cooler", I think 2 is a more useful approach, as it would give the same coverage as 1, but be a lot easier to understand and add to over time.

Vorherrschende Sprache
Python
Sterne
763
Forks
154
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

  • Kein Dockerfile und keine Docker-Compose-Datei
  • Hat eine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus coderedcorp/coderedcms

Alle Issues in coderedcorp/coderedcms

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.