Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata API: remove dateutil requirement #1726

Merged
merged 1 commit into from
Dec 14, 2021

Conversation

MVrachev
Copy link
Collaborator

@MVrachev MVrachev commented Dec 14, 2021

Fixes #1722

Description of the changes being introduced by the pull request:

I added dateutil as a possible argument type for
Signed.bump_expiration() as we are already testing for this and
implying it should be supported.
The problem is that dateutil is not added as a nontest requirement
and after a discussion, we decided we don't want to add it as well.

That's why we decided to remove dateutil mentions from the code
and not confuse our users we support it.

We will create a separate issue discussing the validity of
Metadata.bump_expiration().

Signed-off-by: Martin Vrachev mvrachev@vmware.com

Please verify and check that the pull request fulfills the following
requirements
:

  • The code follows the Code Style Guidelines
  • Tests have been added for the bug fix or new feature
  • Docs have been added for the bug fix or new feature

I added "dateutil" as a possible argument type for
`Metadata.bump_expiration()` as we are already testing for this and
implying it should be supported.
The problem is that "dateutil" is not added as a nontest requirement
and after a discussion, we decided we don't want to add it as well.

That's why we decided to remove "dateutil" mentions from the code
and not confuse our users we support it.

We will create a separate issue discussing the validity of
`Metadata.bump_expiration()`.

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1577091651

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.0004%) to 97.577%

Totals Coverage Status
Change from base Build 1563115608: -0.0004%
Covered Lines: 4091
Relevant Lines: 4176

💛 - Coveralls

Comment on lines -336 to -344
# Test whether dateutil.relativedelta works, this provides a much
# easier to use interface for callers
delta = relativedelta(days=1)
timestamp.signed.bump_expiration(delta)
self.assertEqual(timestamp.signed.expires, datetime(2031, 1, 3, 0, 0))
delta = relativedelta(years=5)
timestamp.signed.bump_expiration(delta)
self.assertEqual(timestamp.signed.expires, datetime(2036, 1, 3, 0, 0))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test code is removed as if we don't make timedelta argument of Signed a Union[timedelta, relativedelta] then mypy complains.

Copy link
Member

@jku jku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

There are ways to test relativedelta usage without making it explicitly part of the API, and we probably want to do that... but since the expiry API has multiple related issues I think this is fine: let's remove relativedelta code completely for now to get a clean build and look for the correct solution to expiry issue in #1727.

@jku jku merged commit f75b58c into theupdateframework:develop Dec 14, 2021
@jku jku mentioned this pull request Dec 14, 2021
3 tasks
@MVrachev MVrachev deleted the dateutil-remove branch December 20, 2021 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metadata API: Remove dependency on dateutil
3 participants