Write developer documentation on writing tests
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
After some reading and testing, I found that I think I want to stick with the following strategy for now:
- Migration testing, which tests the python api responses against the php ones, when set up against the same pre-populated database. This is so we ensure correctness for migration, and have explicit documentation about the differences (in the unit tests, though they should also end up on the migration page)
- Integration testing for expected paths. Simple tests that test the full Python stack, including FastAPI client, dependency injection, and database interactions. For these tests the data will be added to the database on a per-test level. This makes it easy and fast to run tests by any developer- no management of test database state needed. From measurements I did find that creating the TestClient for FastAPI has considerable overhead (approx. 60ms per test). For this reason, we limit this to one test per kind of expected response. E.g., for get_flow: one with a returned flow, one without a result.
- Test database functions directly on a database which have items inserted on a per-test level. This is still surprisingly responsive, so there is no need to mock anything out.
- Test the broader input/output of the different API methods by calling the Python functions directly instead of through the TestClient. This is so we can test more different scenarios, while being fast. It also ensures that if tests fail at the API level (point 1) but not here, we know it is due to changes of FastAPI its configuration. Database calls at this level can be mocked, to better isolate the input/output processing of this function. I have some consideration of not mocking anything out here, to avoid the extra boilerplate. The database fixtures are pretty performant (~2ms).
This is not set in stone. Perhaps we should not even separate tests out this much, and only factoring out the FastAPI layer is enough. If someone with more experience happens to read this, feel free to leave your thoughts :)
- Lingua principale
- Python
- Stelle
- 17
- Fork
- 50
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openml/server-api
-
behavior
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
openml/server-api#337 · 1 commento ·
-
Redesign POST /data/untag for v2Forse di nuovo libera @omosola l’ha presa 36 giorni fa e non c’è nessuna pull request aperta. Apertaproposal
openml/server-api#375 · 2 commenti · 1 assegnatario ·
-
Redesign POST /data/tag for v2Forse di nuovo libera @omosola l’ha presa 36 giorni fa e non c’è nessuna pull request aperta. Aperta
openml/server-api#374 · 2 commenti · 1 assegnatario ·
-
Redesign POST /data/qualities/unprocessed/{data_engine_id}/{order} for v2Forse di nuovo libera @omosola l’ha presa 36 giorni fa e non c’è nessuna pull request aperta. Aperta
openml/server-api#373 · 1 assegnatario ·
-
Redesign POST /data/qualities for v2Forse di nuovo libera @omosola l’ha presa 36 giorni fa e non c’è nessuna pull request aperta. Aperta
openml/server-api#372 · 1 assegnatario ·
Tutte le issue di openml/server-api
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
modelcontextprotocol/python-sdk#3648 ·
I maintainer di solito rispondono entro 1 giorno
-
docs good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
VenetoStato/giorgio#6 ·
-
Claiming namespace ddalusAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
EclipseFdn/open-vsx.org#13831 ·
I maintainer di solito rispondono entro 1 giorno
-
feature request
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 2 giorni