Bug #52696
run-tox-python-common fails in ceph/utils.py on latest centos stream
Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
build
Target version:
-
% Done:
0%
Description
============================= test session starts ============================== platform linux -- Python 3.6.8, pytest-6.2.5, py-1.10.0, pluggy-1.0.0 cachedir: .tox/py3/.pytest_cache rootdir: /working/ceph/src/python-common plugins: mypy-0.8.1 collected 4 items ceph/deployment/service_spec.py .s. [ 75%] ceph/utils.py F [100%] =================================== FAILURES =================================== _____________________ [doctest] ceph.utils.parse_timedelta _____________________ 074 075 Returns a timedelta object represents a duration, the difference 076 between two dates or times. 077 078 >>> parse_timedelta('foo') 079 080 >>> parse_timedelta('2d') Expected: datetime.timedelta(days=2) Got: datetime.timedelta(2) /working/ceph/src/python-common/ceph/utils.py:80: DocTestFailure
Looks like timedelta format may have changed?
Possible patch...
diff --git a/src/python-common/ceph/utils.py b/src/python-common/ceph/utils.py index 89f0654aa0b..87312d6b4e8 100644 --- a/src/python-common/ceph/utils.py +++ b/src/python-common/ceph/utils.py @@ -78,16 +78,16 @@ def parse_timedelta(delta: str) -> Optional[datetime.timedelta]: >>> parse_timedelta('foo') >>> parse_timedelta('2d') - datetime.timedelta(days=2) + datetime.timedelta(2) >>> parse_timedelta("4w") - datetime.timedelta(days=28) + datetime.timedelta(28) >>> parse_timedelta("5s") - datetime.timedelta(seconds=5) + datetime.timedelta(0, 5) >>> parse_timedelta("-5s") - datetime.timedelta(days=-1, seconds=86395) + datetime.timedelta(-1, 86395) :param delta: The string to process, e.g. '2h', '10d', '30s'. :return: The `datetime.timedelta` object or `None` in case of
History
#1 Updated by Brad Hubbard over 2 years ago
Patch in the description was insufficient so found another way per attached PR.
#2 Updated by Brad Hubbard over 2 years ago
- Pull request ID set to 43294
#3 Updated by Brad Hubbard over 2 years ago
- Status changed from New to Fix Under Review
#4 Updated by Brad Hubbard over 2 years ago
- Status changed from Fix Under Review to Resolved