Page MenuHomeSoftware Heritage

Use an attr class instead of a dict to store parsed headers.
ClosedPublic

Authored by vlorentz on Nov 18 2020, 12:47 PM.

Details

Diff Detail

Repository
rDDEP Push deposit
Branch
reorganize-sword
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 17177
Build 26518: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 26517: arc lint + arc unit

Unit TestsFailed

TimeTest
677 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.deposit.tests.api.test_deposit_list::test_deposit_list
partial_deposit = <Deposit: {'id': 38, 'reception_date': datetime.datetime(2020, 11, 18, 11, 48, 52, 180507, tzinfo=<UTC>), 'collection': 'test', 'external_id': 'external-id-partial', 'client': 'test', 'status': 'partial'}> deposited_deposit = <Deposit: {'id': 39, 'reception_date': datetime.datetime(2020, 11, 18, 11, 48, 52, 248897, tzinfo=<UTC>), 'collection': 'test', 'external_id': 'external-id-deposited', 'client': 'test', 'status': 'deposited'}> authenticated_client = <rest_framework.test.APIClient object at 0x7fceec509be0>
569 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.deposit.tests.api.test_deposit_list::test_deposit_list_exclude
partial_deposit = <Deposit: {'id': 40, 'reception_date': datetime.datetime(2020, 11, 18, 11, 48, 52, 969587, tzinfo=<UTC>), 'collection': 'test', 'external_id': 'external-id-partial', 'client': 'test', 'status': 'partial'}> deposited_deposit = <Deposit: {'id': 41, 'reception_date': datetime.datetime(2020, 11, 18, 11, 48, 53, 38116, tzinfo=<UTC>), 'collection': 'test', 'external_id': 'external-id-deposited', 'client': 'test', 'status': 'deposited'}> authenticated_client = <rest_framework.test.APIClient object at 0x7fceec91d470>
414 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.deposit.tests.api.test_checks::test_api_checks_check_metadata_ko[metadata_ko0-expected_summary0]
418 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.deposit.tests.api.test_checks::test_api_checks_check_metadata_ko[metadata_ko1-expected_summary1]
421 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.deposit.tests.api.test_checks::test_api_checks_check_metadata_ok[metadata_ok0]
View Full Test Results (2 Failed · 207 Passed)

Event Timeline

Build has FAILED

Patch application report for D4502 (id=15972)

Could not rebase; Attempt merge onto a67ed6b06b...

Updating a67ed6b0..6d567bba
Fast-forward
 swh/deposit/api/{deposit.py => collection.py}      |  12 +-
 swh/deposit/api/common.py                          | 117 +++++----
 swh/deposit/api/{deposit_content.py => content.py} |  10 +-
 swh/deposit/api/deposit_update.py                  | 277 ---------------------
 swh/deposit/api/edit.py                            | 152 +++++++++++
 swh/deposit/api/edit_media.py                      |  97 ++++++++
 swh/deposit/api/private/deposit_update_status.py   |  12 +-
 swh/deposit/api/service_document.py                |   2 +-
 swh/deposit/api/{deposit_status.py => state.py}    |   4 +-
 swh/deposit/api/sword_edit.py                      |  82 ++++++
 swh/deposit/api/urls.py                            |  44 ++--
 swh/deposit/config.py                              |   3 +-
 swh/deposit/templates/deposit/deposit_receipt.xml  |   4 +-
 .../api/{test_deposit.py => test_collection.py}    |   4 +-
 ...eposit_atom.py => test_collection_post_atom.py} |  11 +-
 ...it_binary.py => test_collection_post_binary.py} |  17 +-
 ...etadata.py => test_collection_post_metadata.py} |   2 +
 ...tipart.py => test_collection_post_multipart.py} |   2 +
 .../api/{test_deposit_delete.py => test_delete.py} |   8 +-
 .../api/test_deposit_private_read_metadata.py      |   4 +-
 swh/deposit/tests/api/test_deposit_update.py       |  43 ++--
 .../{test_deposit_content.py => test_get_file.py}  |   2 +
 swh/deposit/tests/conftest.py                      |   4 +-
 23 files changed, 506 insertions(+), 407 deletions(-)
 rename swh/deposit/api/{deposit.py => collection.py} (91%)
 rename swh/deposit/api/{deposit_content.py => content.py} (88%)
 delete mode 100644 swh/deposit/api/deposit_update.py
 create mode 100644 swh/deposit/api/edit.py
 create mode 100644 swh/deposit/api/edit_media.py
 rename swh/deposit/api/{deposit_status.py => state.py} (95%)
 create mode 100644 swh/deposit/api/sword_edit.py
 rename swh/deposit/tests/api/{test_deposit.py => test_collection.py} (98%)
 rename swh/deposit/tests/api/{test_deposit_atom.py => test_collection_post_atom.py} (97%)
 rename swh/deposit/tests/api/{test_deposit_binary.py => test_collection_post_binary.py} (97%)
 rename swh/deposit/tests/api/{test_deposit_metadata.py => test_collection_post_metadata.py} (99%)
 rename swh/deposit/tests/api/{test_deposit_multipart.py => test_collection_post_multipart.py} (99%)
 rename swh/deposit/tests/api/{test_deposit_delete.py => test_delete.py} (94%)
 rename swh/deposit/tests/api/{test_deposit_content.py => test_get_file.py} (98%)
Changes applied before test
commit 6d567bbac52332f93a7ccf0790326dbcea94d83a
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Nov 18 12:47:00 2020 +0100

    Use an attr class instead of a dict to store parsed headers.
    
    Better typing.

commit b69f60ffab65596fd01ca2b2adbeeaf25bda38f9
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Nov 18 11:48:40 2020 +0100

    Split SE-IRI and Edit-IRI.
    
    SWORD doesn't require them to be the same, and IMO it is clearer
    if we keep them separate.

commit 64371a3dc2133a977244e884a191ad7f0162557c
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Nov 18 11:48:35 2020 +0100

    remove assumption that Edit-IRI and SE-IRI are the same from test_post_deposit_atom_entry_multiple_steps.
    
    Currently they are, but a future commit will make them different.

commit 329a2a3785ad8431fa7ec73fee31e86dbee36911
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Nov 18 11:10:49 2020 +0100

    Rename files and classes in swh/deposit/api/deposit_* to be consistent with SWORD terminology.

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

Build is green

Patch application report for D4502 (id=15980)

Could not rebase; Attempt merge onto a67ed6b06b...

Updating a67ed6b0..466a0f27
Fast-forward
 swh/deposit/api/{deposit.py => collection.py}      |  12 +-
 swh/deposit/api/common.py                          | 117 +++++----
 swh/deposit/api/{deposit_content.py => content.py} |  10 +-
 swh/deposit/api/deposit_update.py                  | 277 ---------------------
 swh/deposit/api/edit.py                            | 152 +++++++++++
 swh/deposit/api/edit_media.py                      |  97 ++++++++
 swh/deposit/api/private/deposit_update_status.py   |  12 +-
 swh/deposit/api/service_document.py                |   2 +-
 swh/deposit/api/{deposit_status.py => state.py}    |   4 +-
 swh/deposit/api/sword_edit.py                      |  82 ++++++
 swh/deposit/api/urls.py                            |  44 ++--
 swh/deposit/config.py                              |   3 +-
 swh/deposit/templates/deposit/deposit_receipt.xml  |   4 +-
 .../api/{test_deposit.py => test_collection.py}    |   4 +-
 ...eposit_atom.py => test_collection_post_atom.py} |  11 +-
 ...it_binary.py => test_collection_post_binary.py} |  17 +-
 ...etadata.py => test_collection_post_metadata.py} |   2 +
 ...tipart.py => test_collection_post_multipart.py} |   2 +
 .../api/{test_deposit_delete.py => test_delete.py} |   8 +-
 .../api/test_deposit_private_read_metadata.py      |   4 +-
 swh/deposit/tests/api/test_deposit_update.py       |  43 ++--
 .../{test_deposit_content.py => test_get_file.py}  |   2 +
 swh/deposit/tests/conftest.py                      |   4 +-
 23 files changed, 506 insertions(+), 407 deletions(-)
 rename swh/deposit/api/{deposit.py => collection.py} (91%)
 rename swh/deposit/api/{deposit_content.py => content.py} (88%)
 delete mode 100644 swh/deposit/api/deposit_update.py
 create mode 100644 swh/deposit/api/edit.py
 create mode 100644 swh/deposit/api/edit_media.py
 rename swh/deposit/api/{deposit_status.py => state.py} (95%)
 create mode 100644 swh/deposit/api/sword_edit.py
 rename swh/deposit/tests/api/{test_deposit.py => test_collection.py} (98%)
 rename swh/deposit/tests/api/{test_deposit_atom.py => test_collection_post_atom.py} (97%)
 rename swh/deposit/tests/api/{test_deposit_binary.py => test_collection_post_binary.py} (97%)
 rename swh/deposit/tests/api/{test_deposit_metadata.py => test_collection_post_metadata.py} (99%)
 rename swh/deposit/tests/api/{test_deposit_multipart.py => test_collection_post_multipart.py} (99%)
 rename swh/deposit/tests/api/{test_deposit_delete.py => test_delete.py} (94%)
 rename swh/deposit/tests/api/{test_deposit_content.py => test_get_file.py} (98%)
Changes applied before test
commit 466a0f27d77c4601fc9933b6f67033de4df51cfe
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Nov 18 12:47:00 2020 +0100

    Use an attr class instead of a dict to store parsed headers.
    
    Better typing.

commit 01cb24d3c44059839d0a1daa9c1947426171c019
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Nov 18 11:48:40 2020 +0100

    Split SE-IRI and Edit-IRI.
    
    SWORD doesn't require them to be the same, and IMO it is clearer
    if we keep them separate.

commit 64371a3dc2133a977244e884a191ad7f0162557c
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Nov 18 11:48:35 2020 +0100

    remove assumption that Edit-IRI and SE-IRI are the same from test_post_deposit_atom_entry_multiple_steps.
    
    Currently they are, but a future commit will make them different.

commit 329a2a3785ad8431fa7ec73fee31e86dbee36911
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Nov 18 11:10:49 2020 +0100

    Rename files and classes in swh/deposit/api/deposit_* to be consistent with SWORD terminology.

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

ardumont added a subscriber: ardumont.

That's pretty cool!

I just asked to remove some redundant types in one docstring inline.

swh/deposit/api/common.py
87

Yes!

402

Remove those, it's already in the method now.

This revision is now accepted and ready to land.Nov 18 2020, 2:47 PM
swh/deposit/api/common.py
402

given the high number of diffs stacked, it's ok to do that later.