File: test-built.py

package info (click to toggle)
pillow 12.1.1-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 72,624 kB
  • sloc: python: 49,768; ansic: 38,750; makefile: 302; sh: 169; javascript: 85
file content (41 lines) | stat: -rwxr-xr-x 1,344 bytes parent folder | download | duplicates (12)
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
#!/usr/bin/env python
import nose
import os
import sys
import glob

# monkey with the path, removing the local directory but adding the Tests/
# directory for helper.py and the other local imports there.

del(sys.path[0])
sys.path.insert(0, os.path.abspath('./Tests'))
if hasattr(sys, 'gettotalrefcount'):
    builddir = glob.glob('build/lib.*-%s-pydebug' % sys.version[:3])[0]
else:
    builddir = glob.glob('build/lib.*-%s' % sys.version[:3])[0]
#print("builddir=%s" % builddir)
sys.path.insert(0, os.path.abspath(builddir))
#print("sys.path=%s" % sys.path)

# if there's no test selected (mostly) choose a working default.
# Something is required, because if we import the tests from the local
# directory, once again, we've got the non-installed PIL in the way
if len(sys.argv) == 1:
    sys.argv.extend(glob.glob('Tests/test*.py'))

# Make sure that nose doesn't muck with our paths.
if ('--no-path-adjustment' not in sys.argv) and ('-P' not in sys.argv):
    sys.argv.insert(1, '--no-path-adjustment')

if 'NOSE_PROCESSES' not in os.environ:
    for arg in sys.argv:
        if '--processes' in arg:
            break
    else: #  for
        sys.argv.insert(1, '--processes=-1') # -1 == number of cores
        sys.argv.insert(1, '--process-timeout=30') 

#print("sys.argv=%s" % sys.argv)    

if __name__ == '__main__':
    nose.main()