mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-08 12:28:00 -05:00
pactest: remove need for pause when running tests
Instead of pausing 1.5 seconds on tests that check file mtimes, change the mtimes to something in the far past so we can immediately tell if a file was modified and/or touched. This saves a decent amount of time on the upgrade tests which often check mtimes. 355 was a completely arbitrary time value, don't ask me why I picked it. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
5b51dbb11e
commit
b3033a59e9
@ -71,9 +71,11 @@ class pmenv:
|
||||
t.generate()
|
||||
# Hack for mtimes consistency
|
||||
for i in t.rules:
|
||||
if i.rule.find("MODIFIED") != -1:
|
||||
time.sleep(1.5)
|
||||
break
|
||||
if i.rule.find("FILE_MODIFIED") != -1:
|
||||
[test, arg] = i.rule.split("=")
|
||||
for f in t.files:
|
||||
if f.name == arg:
|
||||
f.resettimes()
|
||||
|
||||
t.run(self.pacman)
|
||||
|
||||
|
@ -56,6 +56,14 @@ class pmfile:
|
||||
|
||||
return retval
|
||||
|
||||
def resettimes(self):
|
||||
"""
|
||||
"""
|
||||
|
||||
filename = os.path.join(self.root, self.name)
|
||||
os.utime(filename, (355, 355))
|
||||
self.mtime = getmtime(filename)
|
||||
vprint("\tmtime reset (%s)" % self.name)
|
||||
|
||||
if __name__ == "__main__":
|
||||
f = pmfile("/tmp", "foobar")
|
||||
|
Loading…
Reference in New Issue
Block a user