source: orange/Orange/testing/regression/tests_20/modules_server_files_update.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 1.1 KB checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

Line 
1import orngServerFiles
2import os
3reload(orngServerFiles)
4
5domain = "demo"
6filename = "orngServerFiles.py"
7
8print "Downloading domain: %s, file: %s" % (domain, filename) 
9orngServerFiles.download(domain, filename, verbose=False)
10print "Needs update? %s (should be False)" % orngServerFiles.needs_update(domain, filename)
11
12# change the access and modified time of the local file
13# this is stored in the .info file (does not depend on the actual datetime
14# values that we could access through os.stat(path) or set using us.utime)
15path = orngServerFiles.localpath(domain, filename) + ".info"
16f = file(path)
17str = [f.readline()] # first line
18s = "1800" + f.readline()[4:] # second line with date, change it
19print "Changing date to", s.strip() 
20str += [s]
21str += f.readlines() # remaining lines
22f.close()
23f = file(path, "w")
24f.writelines(str)
25f.close()
26
27print "Needs update? %s (should be True)" % orngServerFiles.needs_update(domain, filename)
28print "Updating ..."
29orngServerFiles.update(domain, filename, verbose=False)
30print "Needs update? %s (should be False)" % orngServerFiles.needs_update(domain, filename)
31
Note: See TracBrowser for help on using the repository browser.