Page MenuHomeSoftware Heritage

hypothesis: Fix or ignore deprecation warnings since version 5.6
ClosedPublic

Authored by anlambert on Mar 31 2020, 4:00 PM.

Details

Summary

Since version 5.6, hypothesis warns on @given + function-scoped fixtures
(discussion about the legibility of that change here).

As a consequence a LOT of warnings are now issued when running swh-web tests,
see https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/29/console
for instance.

So turns concerned swh-web fixtures from function-scoped to module-scoped
(there is strictly no difference in tests execution result after that change)
and ignore some warnings related to external function-scoped fixtures that
are safe to use with @given (client from pytest-django and mocker from
pytest-mock).

Diff Detail

Repository
rDWAPPS Web applications
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 D2933 (id=10420)

Rebasing onto fc6dc35126...

Current branch diff-target is up to date.
Changes applied before test
commit 325e979556af4e9505e2d6327b29092dc64afd4d
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Mar 31 12:03:43 2020 +0200

    hypothesis: Fix or ignore deprecation warnings since version 5.6
    
    Since version 5.6, hypothesis warns on `@given` + function-scoped fixtures.
    So turns concerned swh-web fixtures from function-scoped to module-scoped
    (there is strictly no difference in tests execution result after that change)
    and ignore some warnings related to external function-scoped fixtures that
    are safe to use with @given (client from pytest-django and mocker from
    pytest-mock).

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

Build is green

Patch application report for D2933 (id=10423)

Rebasing onto 717159e459...

Current branch diff-target is up to date.
Changes applied before test
commit 91a0c4c8b0947b063391c8b2e6299fcb26bf3eb9
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Mar 31 12:03:43 2020 +0200

    hypothesis: Fix or ignore deprecation warnings since version 5.6
    
    Since version 5.6, hypothesis warns on `@given` + function-scoped fixtures.
    So turns concerned swh-web fixtures from function-scoped to module-scoped
    (there is strictly no difference in tests execution result after that change)
    and ignore some warnings related to external function-scoped fixtures that
    are safe to use with @given (client from pytest-django and mocker from
    pytest-mock).

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

This revision is now accepted and ready to land.Mar 31 2020, 4:37 PM

These fixtures could even be session-scoped

These fixtures could even be session-scoped

Yes you're right, it also works with session-scoped and we gain 4 seconds on tests execution.
I will update that diff.

Update: Use session-scoped fixture instead of module-scoped fixture

Build is green

Patch application report for D2933 (id=10429)

Rebasing onto 717159e459...

Current branch diff-target is up to date.
Changes applied before test
commit f9172f8a395be545df50b14d755a332fbcfa3966
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Tue Mar 31 12:03:43 2020 +0200

    hypothesis: Fix or ignore deprecation warnings since version 5.6
    
    Since version 5.6, hypothesis warns on `@given` + function-scoped fixtures.
    So turns concerned swh-web fixtures from function-scoped to session-scoped
    (there is strictly no difference in tests execution result after that change)
    and ignore some warnings related to external function-scoped fixtures that
    are safe to use with @given (client from pytest-django and mocker from
    pytest-mock).

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