Page MenuHomeSoftware Heritage

model: fix SkippedContent origin to be a str
ClosedPublic

Authored by douardda on Mar 26 2020, 11:32 AM.

Details

Reviewers
anlambert
ardumont
Group Reviewers
Reviewers
Summary

instead of a reference to an Origin entity.

This diff also contains a small code cleanup revision of SkippedContent.from_dict

Diff Detail

Repository
rDMOD Data model
Branch
typecheck
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 11418
Build 17290: tox-on-jenkinsJenkins
Build 17289: arc lint + arc unit

Event Timeline

anlambert added a subscriber: anlambert.

Looks good to me but you should add a test. Ci build seems to fail because some landed diffs are still referenced in dependencies stack (2814 -> 2818).

This revision is now accepted and ready to land.Mar 26 2020, 12:08 PM

Rebase and add a test, as requested.

Depends on D2905.

Build has FAILED

Patch application report for D2884 (id=10373)

Could not rebase; Attempt merge onto 4a2233c5f7...

Updating 4a2233c..3144a80
Fast-forward
 mypy.ini                                      |   4 +-
 requirements.txt                              |   1 +
 swh/model/hypothesis_strategies.py            | 257 +++++++++++++++-------
 swh/model/model.py                            | 305 ++++++++++++++++++--------
 swh/model/tests/test_hypothesis_strategies.py |  28 ++-
 swh/model/tests/test_model.py                 | 134 ++++++++++-
 6 files changed, 557 insertions(+), 172 deletions(-)
Changes applied before test
commit 3144a80ba8b9e6ac66de3bd99318f43a07523d0d
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 23 10:30:00 2020 +0100

    model: small code improvement of SkippedContent.from_dict

commit 6a481121dddf6ce33c19eedb5d1f90af4f311aa8
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 23 10:27:52 2020 +0100

    model: fix SkippedContent origin to be a str
    
    instead of a reference to an Origin entity.

commit 369e0b6892bf6d4633cb0234b7371d4b76055a55
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 23 10:32:39 2020 +0100

    hypothesis: split hypothesis strategies as a dict + entity instance
    
    for each entity model `Model`, provide a `models_d` strategy that
    produces dicts suitable for using as argument for the `Model.from_dict`
    factory method, and reimplement the `models` generator using this
    former hypothesis generator.
    
    This is needed to help writing low level tests for model entities.

commit 28834a6c37b6dfb381831aef3809f407a7c0f787
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Mar 12 16:01:55 2020 +0100

    model: improve a bit the TimestampWithTimezone model
    
    - add a validator for negative_utc (can be True iff offset is 0),
    - update the timestamps_with_timezone hypothesis strategy,
    - add low-level tests for it.

commit ad41de7323ed63f458f3734ba95c4dceb045accc
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Mar 12 14:27:23 2020 +0100

    tests: add low level tests for the Timestamp model entity

commit 96d279e3596a70187bc80fe3bc8aa9ea0a7d94e6
Author: David Douard <david.douard@sdfa3.org>
Date:   Fri Mar 20 12:59:56 2020 +0100

    model: use attrs_static to enforce type validation of model objects
    
    This ensures all instanciated model entities have valid types for attributes.
    
    Related to T2308.

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

Build is green

Patch application report for D2884 (id=10444)

Could not rebase; Attempt merge onto e9a4c7519e...

Updating e9a4c75..601a636
Fast-forward
 mypy.ini                                      |   4 +-
 requirements.txt                              |   1 +
 swh/model/hypothesis_strategies.py            | 271 ++++++++++++++-------
 swh/model/model.py                            | 329 ++++++++++++++++++--------
 swh/model/tests/test_hypothesis_strategies.py |  28 ++-
 swh/model/tests/test_model.py                 | 137 ++++++++++-
 6 files changed, 585 insertions(+), 185 deletions(-)
Changes applied before test
commit 601a6366dffbb7aa592857863ffa2b77f33d9163
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 23 10:30:00 2020 +0100

    model: small code improvement of SkippedContent.from_dict

commit 0f94482ad762b37fb0edb2fb2553d0f205b2bccf
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 23 10:27:52 2020 +0100

    model: fix SkippedContent origin to be a str
    
    instead of a reference to an Origin entity.

commit ada507fddd4b0b51d6412240232ed6f3eab2d207
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 23 10:32:39 2020 +0100

    hypothesis: split hypothesis strategies as a dict + entity instance
    
    for each entity model `Model`, provide a `models_d` strategy that
    produces dicts suitable for using as argument for the `Model.from_dict`
    factory method, and reimplement the `models` generator using this
    former hypothesis generator.
    
    This is needed to help writing low level tests for model entities.

commit 10b069921e74f0d0411fb105349471e0f9a79f29
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Mar 12 16:01:55 2020 +0100

    model: improve a bit the TimestampWithTimezone model
    
    - add a validator for negative_utc (can be True iff offset is 0),
    - update the timestamps_with_timezone hypothesis strategy,
    - add low-level tests for it.

commit ac9d4c84a115c6c8d3aea04ed55635e8e743ea1d
Author: David Douard <david.douard@sdfa3.org>
Date:   Thu Mar 12 14:27:23 2020 +0100

    tests: add low level tests for the Timestamp model entity

commit 85ca7d7848008951f2e26c55c1c72ed9fa92cefb
Author: David Douard <david.douard@sdfa3.org>
Date:   Fri Mar 20 12:59:56 2020 +0100

    model: use attrs_static to enforce type validation of model objects
    
    This ensures all instanciated model entities have valid types for attributes.
    
    Related to T2308.

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

closed by 414a6552143a1e2406bb980ed905969f4b778ad7