Page MenuHomeSoftware Heritage

Port test_statsd.py to pytest and add a statsd test fixture
ClosedPublic

Authored by douardda on Dec 1 2021, 2:00 PM.

Details

Summary

defined in pytest_plugin. Also move the FakeSocket class there. It
should make it easier to write statsd-related tests in dependent
packages.

Also: add magic to mypy ignored packages

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 D6709 (id=24383)

Rebasing onto 51fd3073f9...

Current branch diff-target is up to date.
Changes applied before test
commit 4536f451ca8ab883a52b4d889e4c0a07db5793c2
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Dec 1 13:37:52 2021 +0100

    Port test_statsd.py to pytest and add a statsd test fixture
    
    defined in pytest_plugin. Also move the FakeSocket class there. It
    should make it easier to write statsd-related tests in dependent
    packages.

commit 58ff77995512dddc7f236427231559c96cc06555
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Dec 1 13:47:28 2021 +0100

    Add magic to mypy ignored packages

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

ardumont added a subscriber: ardumont.

cool, thx.

2 remarks inline.

swh/core/tests/test_statsd.py
56 ↗(On Diff #24383)
227 ↗(On Diff #24383)

i usually write it the other way around (and i think it's mostly in other swh modules but meh).
That is "actual_result == expected_result"

This revision is now accepted and ready to land.Dec 1 2021, 2:05 PM
swh/core/tests/test_statsd.py
56 ↗(On Diff #24383)

oopsie

227 ↗(On Diff #24383)

indeed, just ran a query-replace-regex, so dumb results expected...

fix and swap args of 'assert' statements

Build has FAILED

Patch application report for D6709 (id=24408)

Rebasing onto 51fd3073f9...

Current branch diff-target is up to date.
Changes applied before test
commit 6d901bf8005d927206f705a94f3b35c5cf756182
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Dec 1 13:37:52 2021 +0100

    Port test_statsd.py to pytest and add a statsd test fixture
    
    defined in pytest_plugin. Also move the FakeSocket class there. It
    should make it easier to write statsd-related tests in dependent
    packages.

commit 58ff77995512dddc7f236427231559c96cc06555
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Dec 1 13:47:28 2021 +0100

    Add magic to mypy ignored packages

Link to build: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/255/
See console output for more information: https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/255/console

Build is green

Patch application report for D6709 (id=24408)

Rebasing onto 51fd3073f9...

Current branch diff-target is up to date.
Changes applied before test
commit 6d901bf8005d927206f705a94f3b35c5cf756182
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Dec 1 13:37:52 2021 +0100

    Port test_statsd.py to pytest and add a statsd test fixture
    
    defined in pytest_plugin. Also move the FakeSocket class there. It
    should make it easier to write statsd-related tests in dependent
    packages.

commit 58ff77995512dddc7f236427231559c96cc06555
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Dec 1 13:47:28 2021 +0100

    Add magic to mypy ignored packages

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

Add a docstring in statsd fixture and update copyright dates in pytest_plugin.py

Build is green

Patch application report for D6709 (id=24420)

Rebasing onto 51fd3073f9...

Current branch diff-target is up to date.
Changes applied before test
commit 862e1e51a67feac2e6db48beee094edc5ddf61e9
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Dec 1 13:37:52 2021 +0100

    Port test_statsd.py to pytest and add a statsd test fixture
    
    defined in pytest_plugin. Also move the FakeSocket class there. It
    should make it easier to write statsd-related tests in dependent
    packages.

commit 58ff77995512dddc7f236427231559c96cc06555
Author: David Douard <david.douard@sdfa3.org>
Date:   Wed Dec 1 13:47:28 2021 +0100

    Add magic to mypy ignored packages

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