From b3e16b828ab0e521091dd05f709d1907f802e236 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Feb 19 2017 02:18:53 +0000 Subject: Make the fake `get_current_packages` functions more reliable I think the fact that the `time.clock()` values were small floating-point numbers would make the version comparisons sometimes not work as expected. Throwing a big multiplication factor into the works seems to help. Signed-off-by: Adam Williamson --- diff --git a/test_relvalconsumer.py b/test_relvalconsumer.py index a3820d7..ec8ce5a 100644 --- a/test_relvalconsumer.py +++ b/test_relvalconsumer.py @@ -62,7 +62,7 @@ def _fakegetdifferent(self, packages): composes to have different packages, and the 'new' compose (whose package list is checked second) will have 'newer' packages. """ - return {'fakepackage': "fakepackage-{0}-1.fc24.src".format(str(time.clock()))} + return {'fakepackage': "fakepackage-{0}-1.fc24.src".format(str(int(time.clock() * 1000000)))} def _fakegetolder(self, packages): """This is a fake 'get_current_packages' which returns a dict with @@ -71,7 +71,7 @@ def _fakegetolder(self, packages): different packages, and the 'new' compose (whose package list is checked second) will have 'older' packages. """ - return {'fakepackage': "fakepackage-{0}-1.fc24.src".format(str(10 - time.clock()))} + return {'fakepackage': "fakepackage-{0}-1.fc24.src".format(str(10 * 1000000 - int(time.clock() * 1000000)))} def _fakegetcurr1(branched=False): """A faked get_current_release which just returns static values.