2
# uses docutils to execute python statements in documentation files
4
# python test.py tutorial.txt
6
# success means that all of the python comands in the documentation
7
# ran successfully and produced the correct output
16
if sys.version_info[:2] < (2, 4):
17
print "Python version 2.4 or later required for tests (%d.%d detected)." % sys.version_info[:2]
20
nxbase=sys.path[0]+"/../.." # directory of NX package (relative to this)
21
sys.path.insert(0,nxbase) # prepend to search path
26
print "Can't import networkx module"
31
# argv is list of modules to test
36
files.extend(glob.glob(a))
39
print ('Testing networkx %s with Python %s on %s at %s'
40
% (networkx.__version__, sys.version.split()[0],
41
time.strftime('%Y-%m-%d'), time.strftime('%H:%M:%S')))
45
suite = unittest.TestSuite()
46
s = doctest.DocFileSuite(fname,module_relative=False)
48
runner = unittest.TextTestRunner()