~ubuntu-branches/ubuntu/wily/python-networkx/wily

« back to all changes in this revision

Viewing changes to networkx/tests/test.py

  • Committer: Bazaar Package Importer
  • Author(s): Cyril Brulebois
  • Date: 2008-03-02 01:06:32 UTC
  • mfrom: (1.2.1 upstream) (3.1.3 hardy)
  • Revision ID: james.westby@ubuntu.com-20080302010632-1lp6qe1orf59jl8b
* debian/control:
   + Replace python-setuptools with python-pkg-resources in the
     “Recommends:” since pkg_resources is now available in this
     separate package, thanks Matthias Klose (Closes: #468721).
* debian/copyright:
   + Use “© $years $name” instead of invalid “$name, $years” and
     “(C) $years, $name”, thanks to lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
def all():
10
10
    try:
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")]
18
18
    except:
19
 
        tests=glob.glob("*.txt") # this will only work from test directory   
20
 
        tests+=glob.glob("generators/*.txt")
 
19
        import networkx
 
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")  
22
25
 
23
 
    # skip some tests if we don't have numpy or Numeric        
 
26
    # tests depending on numpy
24
27
    try:
25
28
        import numpy
26
29
    except ImportError:
27
 
        try:
28
 
            import Numeric
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\
 
35
               ]
 
36
 
 
37
    # tests depending on scipy        
 
38
    try:
 
39
        import scipy
 
40
    except ImportError:
 
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\
 
44
               ]
 
45
    # tests depending on yaml        
 
46
    try:
 
47
        import yaml
 
48
    except ImportError:
 
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\
 
52
               ]
 
53
    # tests depending on pyparsing
 
54
    try:
 
55
        import pyparsing
 
56
    except ImportError:
 
57
        print "pyparsing not found: skipping tests of gml.py"
 
58
        tests=[t for t in tests \
 
59
               if 'gml.txt' not in t\
 
60
               ]
 
61
 
 
62
 
 
63
 
36
64
 
37
65
 
38
66
    suite = unittest.TestSuite()