Update to_timeval usage to use format_iso8601
GLib.DateTime.to_timeval is deprecated.
This commit is contained in:
parent
0d3cff0dde
commit
9bb1a0916e
@ -1044,11 +1044,9 @@ def get_commit_details(commit, revision=None):
|
|||||||
datetime = sig.get_time()
|
datetime = sig.get_time()
|
||||||
# XXX What do we do with timezone?
|
# XXX What do we do with timezone?
|
||||||
_timezone = sig.get_time_zone()
|
_timezone = sig.get_time_zone()
|
||||||
timeval = GLib.TimeVal()
|
time_str = datetime.format_iso8601()
|
||||||
ok = datetime.to_timeval(timeval)
|
if not time_str:
|
||||||
if not ok:
|
|
||||||
raise CommitTimeValError
|
raise CommitTimeValError
|
||||||
time_str = timeval.to_iso8601()
|
|
||||||
|
|
||||||
return CommitDetails(commit_str, time_str, message, revision)
|
return CommitDetails(commit_str, time_str, message, revision)
|
||||||
|
|
||||||
|
@ -681,7 +681,7 @@ hostname = "testing-bad-recipe"
|
|||||||
|
|
||||||
def test_03_list_commits_commit_time_val_error(self):
|
def test_03_list_commits_commit_time_val_error(self):
|
||||||
"""Test listing recipe commits which raise CommitTimeValError"""
|
"""Test listing recipe commits which raise CommitTimeValError"""
|
||||||
with mock.patch('pylorax.api.recipes.GLib.DateTime.to_timeval', return_value=False):
|
with mock.patch('pylorax.api.recipes.GLib.DateTime.format_iso8601', return_value=False):
|
||||||
commits = recipes.list_commits(self.repo, "master", "test-recipe.toml")
|
commits = recipes.list_commits(self.repo, "master", "test-recipe.toml")
|
||||||
self.assertEqual(len(commits), 0, "Wrong number of commits.")
|
self.assertEqual(len(commits), 0, "Wrong number of commits.")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user