Page MenuHomeSoftware Heritage

pytest_plugin: Add sentry_events fixture from swh-indexer
ClosedPublic

Authored by anlambert on Fri, Sep 9, 11:24 AM.

Details

Summary

In order for that useful fixture to be shared across multiple swh packages,
move it from swh-indexer to main swh-core pytest plugin.

Also add a couple of tests for it.

Related to D8430

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 D8434 (id=30408)

Rebasing onto 843a010cf6...

Current branch diff-target is up to date.
Changes applied before test
commit 1d38e291498e448c06240bc5445ccdcdebe1994f
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Fri Sep 9 11:17:11 2022 +0200

    pytest_plugin: Add sentry_events fixture from swh-indexer
    
    In order for that useful fixture to be shared across multiple swh packages,
    move it from swh-indexer to main swh-core pytest plugin.
    
    Also add a couple of tests for it.

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

olasd added a subscriber: olasd.

Indeed this seems useful; I've made a couple of naming nitpicks, but I don't care very strongly about them.

swh/core/pytest_plugin.py
379

I took a few reads to understand what the yield inner was doing. Maybe renaming inner to setup_sentry_transport_monkeypatch (and the fixture from sentry_init to monkeypatch_sentry_transport?) would have saved me a couple :-)

404

I don't think this uses the monkeypatch fixture? I also think we could call it capture_sentry_events (compare with the caplog builtin fixture?)

This revision is now accepted and ready to land.Fri, Sep 9, 6:28 PM

Update:

  • rename some fixtures
  • remove unneeded monkeypatch fixture use
swh/core/pytest_plugin.py
379

Better naming indeed.

404

I prefer to keep the sentry_events name here as it is shorter.

Build is green

Patch application report for D8434 (id=30437)

Rebasing onto 843a010cf6...

Current branch diff-target is up to date.
Changes applied before test
commit 5a898b2d565061b2a49c4d2cd0fcb74d1c9292de
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Fri Sep 9 11:17:11 2022 +0200

    pytest_plugin: Add sentry_events fixture from swh-indexer
    
    In order for that useful fixture to be shared across multiple swh
    packages, move it from swh-indexer to main swh-core pytest plugin.
    
    Also add a couple of tests for it.

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