Page MenuHomeSoftware Heritage

test_api_client: refactor the code for new pytest based infra
ClosedPublic

Authored by douardda on Oct 10 2019, 5:50 PM.

Details

Summary

This uses the latest pytest fixtures added in swh.core to define a
swh_storage fixture that setup a RPC client/server stack to execute
tests defined in classes TestStorage and TestStorageGeneratedData
(from swh.storage.tests.test_storage).

Test Plan

all tests should now pass using pytest

Diff Detail

Repository
rDSTO Storage manager
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Note that this Diff require also D2116

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/storage/tests/test_api_client.py
34

Let's use a better name; there are already too many app variables in our code

47

it should be un-monkeypatched at the end of the fixture.

59

Should be un-patched at end too

This revision now requires changes to proceed.Oct 11 2019, 4:56 PM
swh/storage/tests/test_api_client.py
34

I've stick to the fixture name used in pytest-flask (even if I do not use this package, in the end).

34

And more importantly, it's what is expected by the rpc client/server fixture stuff in swh.core.pytest_plugin...

ardumont added a subscriber: ardumont.
ardumont added inline comments.
swh/storage/tests/test_api_client.py
47

can you enlighten me as to why?

And also how to do that?

swh/storage/tests/test_api_client.py
47

it should be un-monkeypatched at the end of the fixture.

I don't think it's useful in any case, but meh.

swh/storage/tests/test_api_client.py
34

Ok for app

47

I don't think it's useful in any case, but meh.

I don't want to waste time debugging when we'll write a test that expects the un-patched version .

douardda edited the summary of this revision. (Show Details)

rebased

This revision is now accepted and ready to land.Oct 14 2019, 1:18 PM