11
# import ez_setup # force use of setuptools
12
# ez_setup.use_setuptools()
13
11
from pkg_resources import resource_filename, resource_listdir
14
12
tests=[resource_filename(__name__, t)
15
13
for t in resource_listdir("networkx",'tests') if t.endswith("txt")]
16
14
tests+=[resource_filename(__name__, 'generators/'+t)
17
15
for t in resource_listdir("networkx",'tests/generators') if t.endswith("txt")]
16
tests+=[resource_filename(__name__, 'readwrite/'+t)
17
for t in resource_listdir("networkx",'tests/readwrite') if t.endswith("txt")]
19
tests=glob.glob("*.txt") # this will only work from test directory
20
tests+=glob.glob("generators/*.txt")
20
base=os.path.dirname(networkx.__file__)+"/tests/"
21
tests=glob.glob(base+"*.txt")
22
tests+=glob.glob(base+"generators/*.txt")
23
tests+=glob.glob(base+"readwrite/*.txt")
21
24
#tests+=glob.glob("drawing/*.txt")
23
# skip some tests if we don't have numpy or Numeric
26
# tests depending on numpy
26
29
except ImportError:
30
print "Neither numpy or Numeric found."
31
print "Skipping tests of spectrum.py and threshold.py"
32
tests.remove('spectrum.txt')
33
tests.remove('threshold.txt')
34
# tests=[t for t in tests if 'spectrum.txt' not in t \
35
# if 'threshold.txt' not in t]
30
print "numpy not found: skipping tests of spectrum.py, threshold.py, convert.py (numpy)"
31
tests=[t for t in tests \
32
if 'spectrum.txt' not in t \
33
if 'threshold.txt' not in t\
34
if 'convert_numpy.txt' not in t\
37
# tests depending on scipy
41
print "scipy not found: skipping tests of convert.py (scipy)"
42
tests=[t for t in tests \
43
if 'convert_scipy.txt' not in t\
45
# tests depending on yaml
49
print "yaml not found: skipping tests of nx_yaml.py (yaml)"
50
tests=[t for t in tests \
51
if 'nx_yaml.txt' not in t\
53
# tests depending on pyparsing
57
print "pyparsing not found: skipping tests of gml.py"
58
tests=[t for t in tests \
59
if 'gml.txt' not in t\
38
66
suite = unittest.TestSuite()