Python: Generate Test Case Stubs For All Classes In A Module
I had a module full of classes. I wanted to generate a unittest.TestCase stub for every class, such as this:
# TODO: Finish this
class Test_className(unittest.TestCase):
def setUp(self):
pass
So, I wrote the following Python script:
if __name__=="__main__":
file = "c:/dev/sourceFile.py"
f [...]
Python: List files older than or newer than a specific date and time
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os, sys
from datetime import date, timedelta, datetime
from time import localtime
import re
files = os.listdir(’c:/windows/system32/’)
files = [ f for f in files if re.search(’.dll$’, f, re.I)]
files.sort()
d = datetime.now() – timedelta(days=30)
d = d.timetuple()
oldfiles = 0
newfiles = 0
for file in files:
filetimesecs = os.path.getmtime(’c:/windows/system32/’ + file)
filetime = localtime(filetimesecs)
# print "*******************************"
# print [...]

