Page MenuHomeSoftware Heritage

tests: Clean hashutil._blake2_hash_cache after mocking blake2 functions.
ClosedPublic

Authored by vlorentz on Feb 19 2021, 10:32 AM.

Details

Summary

Depending on the order in which tests are run, these tests may insert
lambdas with mocked blake2 functions in their closure to be inserted in
hashutil._blake2_hash_cache; causing all future tests to fail.

While this does not happen with the default order of tests, it does when
using pytest-xdist.

Diff Detail

Repository
rDMOD Data model
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 19371
Build 30038: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 30037: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D5113 (id=18285)

Rebasing onto 0c16581283...

Current branch diff-target is up to date.
Changes applied before test
commit fc9586ac45c0425f96b8d3d8a5c574b854cb6a3e
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Feb 19 10:29:03 2021 +0100

    tests: Clean hashutil._blake2_hash_cache after mocking blake2 functions.
    
    Depending on the order in which tests are run, these tests may insert
    lambdas with mocked blake2 functions in their closure to be inserted in
    hashutil._blake2_hash_cache; causing all future tests to fail.
    
    While this does not happen with the default order of tests, it does when
    using pytest-xdist.

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

ardumont added a subscriber: ardumont.

ok

not sure we need to open the function_name parameter in the paatch_blake2 function
since the input is always pyblake2.blake2s (well in that diff at least) but fine.

swh/model/tests/test_hashutil.py
1

2021

This revision is now accepted and ready to land.Feb 19 2021, 10:47 AM

since the input is always pyblake2.blake2s (well in that diff at least) but fine.

look closer ;)

since the input is always pyblake2.blake2s (well in that diff at least) but fine.

look closer ;)

heh, right, blake2b!
thanks.

This revision was landed with ongoing or failed builds.Feb 19 2021, 10:49 AM
This revision was automatically updated to reflect the committed changes.

Build is green

Patch application report for D5113 (id=18289)

Rebasing onto 0c16581283...

Current branch diff-target is up to date.
Changes applied before test
commit 758eb885d38fb3fd51871b5171d3056b0ac8ae27
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Fri Feb 19 10:29:03 2021 +0100

    tests: Clean hashutil._blake2_hash_cache after mocking blake2 functions.
    
    Depending on the order in which tests are run, these tests may insert
    lambdas with mocked blake2 functions in their closure to be inserted in
    hashutil._blake2_hash_cache; causing all future tests to fail.
    
    While this does not happen with the default order of tests, it does when
    using pytest-xdist.

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