Page MenuHomeSoftware Heritage

core tests: disambiguate arg 'request' through typing
ClosedPublic

Authored by tenma on Oct 29 2020, 3:15 PM.

Details

Summary

Both requests.Request and _pytest.FixtureRequest objects are passed to
test fixtures as argument 'request'. This hurts readability.
Adding typing annotations makes it clear which one is meant.

Diff Detail

Repository
rDCORE Foundations and core functionalities
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 D4382 (id=15494)

Rebasing onto eefe1b6336...

Current branch diff-target is up to date.
Changes applied before test
commit 0005aebe550caf2d853912f6343970cf627bb3a8
Author: tenma <tenma+swh@mailbox.org>
Date:   Thu Oct 29 14:43:52 2020 +0100

    tests: disambiguate arg 'request' through typing
    
    Both requests.Request and _pytest.FixtureRequest objects are passed to
    test fixtures as argument 'request'. This hurts readability.
    Adding typing annotations makes it clear which one is meant.

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

ardumont added a subscriber: ardumont.
ardumont added inline comments.
swh/core/pytest_plugin.py
12

no need for the comment

This revision is now accepted and ready to land.Oct 29 2020, 4:30 PM

Build is green

Patch application report for D4382 (id=15503)

Rebasing onto 745448399e...

First, rewinding head to replay your work on top of it...
Applying: core tests: disambiguate arg 'request' through typing
Changes applied before test
commit f66c70622ca0294d5d6413196b7f55406223cc8b
Author: tenma <tenma+swh@mailbox.org>
Date:   Thu Oct 29 14:43:52 2020 +0100

    core tests: disambiguate arg 'request' through typing
    
    Both requests.Request and _pytest.FixtureRequest objects are passed to
    test fixtures as argument 'request'. This hurts readability.
    Adding typing annotations makes it clear which one is meant.

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

tenma retitled this revision from tests: disambiguate arg 'request' through typing to core tests: disambiguate arg 'request' through typing.Oct 29 2020, 4:36 PM

Build is green

Patch application report for D4382 (id=15504)

Rebasing onto 745448399e...

Current branch diff-target is up to date.
Changes applied before test
commit 12fa6f263d48fdd200601057c0f724a60b771965
Author: tenma <tenma+swh@mailbox.org>
Date:   Thu Oct 29 14:43:52 2020 +0100

    core tests: disambiguate arg 'request' through typing
    
    Both requests.Request and _pytest.FixtureRequest objects are passed to
    test fixtures as argument 'request'. This hurts readability.
    Adding typing annotations makes it clear which one is meant.

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