Page MenuHomeSoftware Heritage

Move get_scheduler monkeypatching into an explicit pytest fixture
ClosedPublic

Authored by olasd on Jul 16 2020, 12:21 PM.

Details

Summary

This allows us to actually run the lister instantiation code instead of relying
on the underlying structure of the lister object. In turn, this allows future
listers to use the scheduler right in their init.

Depends on D3524.

Test Plan

tox

Diff Detail

Repository
rDLS Listers
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 D3525 (id=12451)

Could not rebase; Attempt merge onto 5f1fbbe8a4...

Updating 5f1fbbe..211f461
Fast-forward
 MANIFEST.in                       |  3 +--
 conftest.py                       | 18 ++++++++++++++++++
 swh/lister/core/tests/conftest.py |  4 +---
 swh/lister/tests/test_cli.py      |  2 +-
 4 files changed, 21 insertions(+), 6 deletions(-)
Changes applied before test
commit 211f4610df2006e939bb3f6e8f2cb7b87151dfba
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Thu Jul 16 11:45:58 2020 +0200

    Move get_scheduler monkeypatching into an explicit pytest fixture
    
    This allows us to actually run the lister instantiation code instead of relying
    on the underlying structure of the lister object. In turn, this allows future
    listers to use the scheduler right in their __init__.

commit d0c1df65f1f4b05cd9e766ee3916d25182ecdb25
Author: Nicolas Dandrimont <nicolas@dandrimont.eu>
Date:   Thu Jul 16 10:27:54 2020 +0200

    Only include relevant data files in MANIFEST.in
    
    The previous include would pull all .mypy_cache directories too, which are quite
    large as they include the SQLAlchemy stubs.

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

ardumont added a subscriber: ardumont.

This allows us to actually run the lister instantiation code instead of relying on the underlying structure of the lister object

I don't follow all the sentence, the lister instantiation did take place before...
...
oh but it got "monkeypatched" all the time...
Now that happens only when we explicit the use of that fixture mock_get_scheduler in the test.

Given enough reading, the puzzle pieces fall into place ;)

This revision is now accepted and ready to land.Jul 16 2020, 12:55 PM