Page MenuHomeSoftware Heritage

pytest_plugin: Add sentry_events fixture from swh-indexer
ClosedPublic

Authored by anlambert on Sep 9 2022, 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
Branch
add-sentry-events-fixture
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 31425
Build 49156: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 49155: arc lint + arc unit

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
380

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 :-)

405

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.Sep 9 2022, 6:28 PM

Update:

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

Better naming indeed.

405

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.