Page MenuHomeSoftware Heritage

test: Deal with divergent test output depending on magic version
ClosedPublic

Authored by ardumont on Nov 27 2020, 10:39 AM.

Details

Summary

This fixes the indexer debian package build.

=================================== FAILURES ===================================
________________________ test_compute_mimetype_encoding ________________________

def test_compute_mimetype_encoding():
    """Compute mimetype encoding should return results"""
        for _input, _mimetype, _encoding in [
                ("du français".encode(), "text/plain", "utf-8"),
                (b"def __init__(self):", "text/x-python", "us-ascii"),
                (b"\xff\xfe\x00\x00\x00\x00\xff\xfe\xff\xff", "application/octet-stream", ""),
        ]:
            actual_result = compute_mimetype_encoding(_input)
            >           assert actual_result == {"mimetype": _mimetype, "encoding": _encoding}
            E           AssertionError: assert {'encoding': ...cript.python'} == {'encoding': '...ext/x-python'}
            E             Omitting 1 identical items, use -vv to show
            E             Differing items:
            E             {'mimetype': 'text/x-script.python'} != {'mimetype': 'text/x-python'}
            E             Use -v to get the full diff

swh/indexer/tests/test_mimetype.py:36: AssertionError
Test Plan

tox

Diff Detail

Repository
rDCIDX Metadata indexer
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

ardumont edited the summary of this revision. (Show Details)

Build is green

Patch application report for D4619 (id=16370)

Could not rebase; Attempt merge onto 3d2034d572...

Updating 3d2034d..d87fd53
Fast-forward
 swh/indexer/tests/test_mimetype.py | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
Changes applied before test
commit d87fd5311433b988977271520ab3d2138fb1b9fc
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Nov 27 10:35:18 2020 +0100

    test: Deal with divergent test output depending on magic version
    
    This fixes the indexer debian package build.

commit 8c95b872555ed6dd8e611a06747afe7805b84546
Author: Antoine R. Dumont (@ardumont) <ardumont@softwareheritage.org>
Date:   Fri Nov 27 10:26:49 2020 +0100

    test_mimetype: Refactor test to use pytest.mark.parametrize
    
    It's simplifying reading and more consistent with other similar tests

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

This revision was not accepted when it landed; it landed in state Needs Review.Nov 27 2020, 10:42 AM
This revision was automatically updated to reflect the committed changes.

flemme
i wanted to push the debian/unstable-swh, not the master one... T.T