kopia lustrzana https://github.com/F5OEO/tstools
Support an alternative location of test data, and also lose (notional) Python
2.2 support in the rundoctest script. --HG-- extra : convert_revision : svn%3Aeff31bef-be4a-0410-a8fe-e47997df2690/trunk%4035issue20
rodzic
d036b098e6
commit
33f2feef01
|
@ -30,23 +30,13 @@ def main():
|
|||
if not filename:
|
||||
filename = "test.txt"
|
||||
|
||||
try:
|
||||
(failures,tests) = doctest.testfile(filename,verbose=verbose)
|
||||
if failures > 0:
|
||||
print doctest.DIVIDER
|
||||
except:
|
||||
# e.g., Python 2.2
|
||||
tester = doctest.Tester(globs={},verbose=verbose)
|
||||
f = open(filename)
|
||||
(failures,tests) = tester.runstring(f.read(),filename)
|
||||
f.close()
|
||||
if failures > 0:
|
||||
print "*"*65
|
||||
(failures,tests) = doctest.testfile(filename,verbose=verbose)
|
||||
|
||||
testword = "test"
|
||||
if tests != 1: testword = "tests"
|
||||
failword = "failure"
|
||||
if failures != 1: failword = "failures"
|
||||
print
|
||||
print "File %s: %d %s, %d %s"%(filename,tests,testword,failures,failword)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
10
test.txt
10
test.txt
|
@ -10,12 +10,16 @@ will have to manage without. This is still better than no testing...
|
|||
First, check we've got the basics working:
|
||||
|
||||
>>> from tstools import ESStream
|
||||
>>> stream = ESStream(test_es_file)
|
||||
>>> try:
|
||||
... stream = ESStream(test_es_file)
|
||||
... except:
|
||||
... test_es_file = '/home/tibs/Videos/aladdin.es'
|
||||
... stream = ESStream(test_es_file)
|
||||
|
||||
The filename is available as a "readonly" value:
|
||||
|
||||
>>> stream.filename
|
||||
'/Users/tibs/sw/tstools/data/aladdin.es'
|
||||
>>> stream.filename == test_es_file
|
||||
True
|
||||
|
||||
We should be able to iterate over its ES units:
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue