Page MenuHomeSoftware Heritage

tests/journal_client: Use pytest-redis fixture instead of mocks
ClosedPublic

Authored by anlambert on Jun 22 2021, 3:24 PM.

Details

Summary

It makes the tests much simpler to read, use of mocks should be avoided
when it is possible.

Diff Detail

Repository
rDCNT Archive counters
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D5909 (id=21203)

Rebasing onto f4a98c8095...

Current branch diff-target is up to date.
Changes applied before test
commit e9fd9ff7900df7388c7c9c96997cdb8c021a560b
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Jun 22 15:23:17 2021 +0200

    tests/journal_client: Use pytest-redis fixture instead of mocks
    
    It makes the tests much simpler to read, use of mocks should be avoided
    when it is possible.

See https://jenkins.softwareheritage.org/job/DCNT/job/tests-on-diff/54/ for more details.

This revision is now accepted and ready to land.Jun 22 2021, 5:00 PM

Build is green

Patch application report for D5909 (id=21206)

Rebasing onto d4ce0c497f...

Current branch diff-target is up to date.
Changes applied before test
commit 2be3cf1bc226ac2b5e9051b0786926b2e0e48fa7
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Jun 22 15:23:17 2021 +0200

    tests/journal_client: Use pytest-redis fixture instead of mocks
    
    It makes the tests much simpler to read, use of mocks should be avoided
    when it is possible.

See https://jenkins.softwareheritage.org/job/DCNT/job/tests-on-diff/56/ for more details.

vsellier added a subscriber: vsellier.

LGTM thanks it's obviously less complicated

Just a little observation regarding an unused constant

swh/counters/tests/test_journal_client.py
26–27

this constant is not used anymore if I'm not wrong

swh/counters/tests/test_journal_client.py
26–27

Right, I forgot to remove it. Let's do the rebase dance again then ;-)

Remove no longer used constant

Build is green

Patch application report for D5909 (id=21209)

Rebasing onto d4ce0c497f...

Current branch diff-target is up to date.
Changes applied before test
commit a3ea67faa9b995990d58fbba45e5342002304294
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Jun 22 15:23:17 2021 +0200

    tests/journal_client: Use pytest-redis fixture instead of mocks
    
    It makes the tests much simpler to read, use of mocks should be avoided
    when it is possible.

See https://jenkins.softwareheritage.org/job/DCNT/job/tests-on-diff/58/ for more details.