-
Notifications
You must be signed in to change notification settings - Fork 42
Description
Description:
The unit tests in the data modules (MPC, Horizons, ...) are somewhat notorious to fail due to connection errors, timeouts etc. This makes the unit test fail, even tough the underlying function might work correctly, which is especially annoying in CI (see e.g. https://dev.azure.com/tudat-team/feedstock-builds/_build/results?buildId=2505&view=logs&j=c8b8640e-759f-5af3-65b5-809c078c71b1&t=f5b821d2-45c4-5128-2768-5052952aa5c6&l=11176).
Since the specific contents (numerical values, meta data, ...) of the returned data typically does not matter in a unit test, it is common practice to "mock" the return data and bypass the API call. This avoids connection/timeout errors raising false test fails, while still testing the underlying functionality.
Suggestions for implementation:
In pytest, this can be achieved by "monkey-patching" returned objects: https://docs.pytest.org/en/latest/how-to/monkeypatch.html#monkeypatching-returned-objects-building-mock-classes
Additional context:
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status