Page MenuHomeSoftware Heritage

model: add support for ctime in [Skipped]Content.from_[data,dict]()
ClosedPublic

Authored by douardda on Mar 27 2020, 3:05 PM.

Details

Reviewers
vlorentz
ardumont
Group Reviewers
Reviewers
Summary

With support for str representation of date.
Mostly for testing purpose.

Depends on D2884.

Diff Detail

Event Timeline

vlorentz added a subscriber: vlorentz.
vlorentz added inline comments.
swh/model/tests/test_hypothesis_strategies.py
51

forgot this guy

swh/model/tests/test_model.py
21

s/hypos/strategies/

This revision now requires changes to proceed.Mar 27 2020, 4:43 PM

Rebase + comments from vlorentz

Build has FAILED

Patch application report for D2906 (id=10374)

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

Updating 4a2233c..ebd5ab2
Fast-forward
 mypy.ini                                      |   4 +-
 requirements.txt                              |   1 +
 swh/model/hypothesis_strategies.py            | 259 +++++++++++++-------
 swh/model/model.py                            | 324 ++++++++++++++++++--------
 swh/model/tests/test_hypothesis_strategies.py |  33 ++-
 swh/model/tests/test_model.py                 | 156 ++++++++++++-
 6 files changed, 589 insertions(+), 188 deletions(-)
Changes applied before test
commit ebd5ab23a9215aa5f8f023b4ed2f3f86ae41e4c5
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 23 10:31:03 2020 +0100

    model: add support for ctime in [Skipped]Content.from_[data,dict]()
    
    With support for str representation of date.
    Mostly for testing purpose.

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/7/
See console output for more information: https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/7/console

Build is green

Patch application report for D2906 (id=10374)

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

Updating 4a2233c..ebd5ab2
Fast-forward
 mypy.ini                                      |   4 +-
 requirements.txt                              |   1 +
 swh/model/hypothesis_strategies.py            | 259 +++++++++++++-------
 swh/model/model.py                            | 324 ++++++++++++++++++--------
 swh/model/tests/test_hypothesis_strategies.py |  33 ++-
 swh/model/tests/test_model.py                 | 156 ++++++++++++-
 6 files changed, 589 insertions(+), 188 deletions(-)
Changes applied before test
commit ebd5ab23a9215aa5f8f023b4ed2f3f86ae41e4c5
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 23 10:31:03 2020 +0100

    model: add support for ctime in [Skipped]Content.from_[data,dict]()
    
    With support for str representation of date.
    Mostly for testing purpose.

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.

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

with the actual revision merged in...

Build is green

Patch application report for D2906 (id=10389)

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

Updating 4a2233c..e43a206
Fast-forward
 mypy.ini                                      |   4 +-
 requirements.txt                              |   1 +
 swh/model/hypothesis_strategies.py            | 259 +++++++++++++-------
 swh/model/model.py                            | 324 ++++++++++++++++++--------
 swh/model/tests/test_hypothesis_strategies.py |  32 ++-
 swh/model/tests/test_model.py                 | 156 ++++++++++++-
 6 files changed, 588 insertions(+), 188 deletions(-)
Changes applied before test
commit e43a20668775830a879ca4ef5dac8927a9203241
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 23 10:31:03 2020 +0100

    model: add support for ctime in [Skipped]Content.from_[data,dict]()
    
    With support for str representation of date.
    Mostly for testing purpose.

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.

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

ardumont added a subscriber: ardumont.
ardumont added inline comments.
swh/model/model.py
613

Apparently missing the associated test case (thank the tooling for that one ;)

swh/model/tests/test_model.py
358

Please, add one case where the ctime value is a string and that should cover my previous comment ;)

This revision now requires changes to proceed.Mar 31 2020, 10:06 AM

add a test for ctime as string in Content.from_dict()

Build is green

Patch application report for D2906 (id=10403)

Could not rebase; Attempt merge onto accca603c4...

Merge made by the 'recursive' strategy.
 mypy.ini                                      |   4 +-
 requirements.txt                              |   1 +
 swh/model/hypothesis_strategies.py            | 259 +++++++++++++-------
 swh/model/model.py                            | 324 ++++++++++++++++++--------
 swh/model/tests/test_hypothesis_strategies.py |  32 ++-
 swh/model/tests/test_model.py                 | 172 +++++++++++++-
 6 files changed, 604 insertions(+), 188 deletions(-)
Changes applied before test
commit ddb63b085abb24d1ab4a46fdbf216dd0ff45925c
Merge: accca60 af2fd46
Author: Jenkins user <jenkins@localhost>
Date:   Tue Mar 31 08:47:13 2020 +0000

    Merge branch 'diff-target' into HEAD

commit af2fd46e610eacc555c28ddd2cf7d4e6be0f0bf1
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 23 10:31:03 2020 +0100

    model: add support for ctime in [Skipped]Content.from_[data,dict]()
    
    With support for str representation of date.
    Mostly for testing purpose.

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.

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

This revision is now accepted and ready to land.Mar 31 2020, 4:16 PM

Build is green

Patch application report for D2906 (id=10445)

Could not rebase; Attempt merge onto e9a4c7519e...

Updating e9a4c75..677bdad
Fast-forward
 mypy.ini                                      |   4 +-
 requirements.txt                              |   1 +
 swh/model/hypothesis_strategies.py            | 273 ++++++++++++++------
 swh/model/model.py                            | 348 ++++++++++++++++++--------
 swh/model/tests/test_hypothesis_strategies.py |  32 ++-
 swh/model/tests/test_model.py                 | 176 ++++++++++++-
 6 files changed, 631 insertions(+), 203 deletions(-)
Changes applied before test
commit 677bdad4a34fbaf7bf0bdafb6a49d428256f8991
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Mar 23 10:31:03 2020 +0100

    model: add support for ctime in [Skipped]Content.from_[data,dict]()
    
    With support for str representation of date.
    Mostly for testing purpose.

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/23/ for more details.

closed by ca0f6a1eb7e6079ee0b8a649ff40353409c86560