File: testall.py

package info (click to toggle)
rpy 1.0.3-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 636 kB
  • ctags: 774
  • sloc: ansic: 2,139; python: 1,591; makefile: 119; sh: 73
file content (43 lines) | stat: -rw-r--r-- 939 bytes parent folder | download | duplicates (4)
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
33
34
35
36
37
38
39
40
41
42
43
import os
import sys
import unittest
import random

import rpy


def run(module):
    try:
        unittest.main(module)
    except SystemExit:
        pass

if __name__ == '__main__':
    modules = os.listdir('.')

    if '--random' in sys.argv:
        shuffle=True
        sys.argv.remove('--random')
    else:
        shuffle=False

    if '--loop' in sys.argv:
	niter = 1000
        sys.argv.remove('--loop')
    else:
	niter = 1


    modules = filter( lambda x: not x.endswith('.pyc'), modules)
    modules = filter( lambda x: x.startswith('test_'), modules)
    modules = filter( lambda x: x.endswith('.py'), modules)

    print "Modules to be tested:", modules
    
    for iter in range(niter):
        if shuffle: random.shuffle(modules)
        for module in modules:
            name = module[:-3]
            print 'Testing:', name
            rpy.set_default_mode(rpy.NO_DEFAULT)  # reset to base case
            run(name)