##// END OF EJS Templates
Testing cleanup of old/conflicting stuff.
Fernando Perez -
Show More
1 NO CONTENT: file renamed from IPython/testing/ipdoctest.py to IPython/testing/attic/ipdoctest.py
NO CONTENT: file renamed from IPython/testing/ipdoctest.py to IPython/testing/attic/ipdoctest.py
1 NO CONTENT: file renamed from IPython/testing/parametric.py to IPython/testing/attic/parametric.py
NO CONTENT: file renamed from IPython/testing/parametric.py to IPython/testing/attic/parametric.py
1 NO CONTENT: file renamed from IPython/testing/tcommon.py to IPython/testing/attic/tcommon.py
NO CONTENT: file renamed from IPython/testing/tcommon.py to IPython/testing/attic/tcommon.py
1 NO CONTENT: file renamed from IPython/testing/testTEMPLATE.py to IPython/testing/attic/testTEMPLATE.py
NO CONTENT: file renamed from IPython/testing/testTEMPLATE.py to IPython/testing/attic/testTEMPLATE.py
1 NO CONTENT: file renamed from IPython/testing/tstTEMPLATE_doctest.py to IPython/testing/attic/tstTEMPLATE_doctest.py
NO CONTENT: file renamed from IPython/testing/tstTEMPLATE_doctest.py to IPython/testing/attic/tstTEMPLATE_doctest.py
1 NO CONTENT: file renamed from IPython/testing/tstTEMPLATE_doctest.txt to IPython/testing/attic/tstTEMPLATE_doctest.txt
NO CONTENT: file renamed from IPython/testing/tstTEMPLATE_doctest.txt to IPython/testing/attic/tstTEMPLATE_doctest.txt
@@ -1,72 +1,86 b''
1 """Utilities for testing code.
1 """DEPRECATED - use IPython.testing.util instead.
2
3 Utilities for testing code.
2 """
4 """
3
5
6 #############################################################################
7
8 # This was old testing code we never really used in IPython. The pieces of
9 # testing machinery from snakeoil that were good have already been merged into
10 # the nose plugin, so this can be taken away soon. Leave a warning for now,
11 # we'll remove it in a later release (around 0.10 or so).
12 from warnings import warn
13 warn('This will be removed soon. Use IPython.testing.util instead',
14 DeprecationWarning)
15
16 #############################################################################
17
4 # Required modules and packages
18 # Required modules and packages
5
19
6 # Standard Python lib
20 # Standard Python lib
7 import os
21 import os
8 import sys
22 import sys
9
23
10 # From this project
24 # From this project
11 from IPython.tools import utils
25 from IPython.tools import utils
12
26
13 # path to our own installation, so we can find source files under this.
27 # path to our own installation, so we can find source files under this.
14 TEST_PATH = os.path.dirname(os.path.abspath(__file__))
28 TEST_PATH = os.path.dirname(os.path.abspath(__file__))
15
29
16 # Global flag, used by vprint
30 # Global flag, used by vprint
17 VERBOSE = '-v' in sys.argv or '--verbose' in sys.argv
31 VERBOSE = '-v' in sys.argv or '--verbose' in sys.argv
18
32
19 ##########################################################################
33 ##########################################################################
20 # Code begins
34 # Code begins
21
35
22 # Some utility functions
36 # Some utility functions
23 def vprint(*args):
37 def vprint(*args):
24 """Print-like function which relies on a global VERBOSE flag."""
38 """Print-like function which relies on a global VERBOSE flag."""
25 if not VERBOSE:
39 if not VERBOSE:
26 return
40 return
27
41
28 write = sys.stdout.write
42 write = sys.stdout.write
29 for item in args:
43 for item in args:
30 write(str(item))
44 write(str(item))
31 write('\n')
45 write('\n')
32 sys.stdout.flush()
46 sys.stdout.flush()
33
47
34 def test_path(path):
48 def test_path(path):
35 """Return a path as a subdir of the test package.
49 """Return a path as a subdir of the test package.
36
50
37 This finds the correct path of the test package on disk, and prepends it
51 This finds the correct path of the test package on disk, and prepends it
38 to the input path."""
52 to the input path."""
39
53
40 return os.path.join(TEST_PATH,path)
54 return os.path.join(TEST_PATH,path)
41
55
42 def fullPath(startPath,files):
56 def fullPath(startPath,files):
43 """Make full paths for all the listed files, based on startPath.
57 """Make full paths for all the listed files, based on startPath.
44
58
45 Only the base part of startPath is kept, since this routine is typically
59 Only the base part of startPath is kept, since this routine is typically
46 used with a script's __file__ variable as startPath. The base of startPath
60 used with a script's __file__ variable as startPath. The base of startPath
47 is then prepended to all the listed files, forming the output list.
61 is then prepended to all the listed files, forming the output list.
48
62
49 :Parameters:
63 :Parameters:
50 startPath : string
64 startPath : string
51 Initial path to use as the base for the results. This path is split
65 Initial path to use as the base for the results. This path is split
52 using os.path.split() and only its first component is kept.
66 using os.path.split() and only its first component is kept.
53
67
54 files : string or list
68 files : string or list
55 One or more files.
69 One or more files.
56
70
57 :Examples:
71 :Examples:
58
72
59 >>> fullPath('/foo/bar.py',['a.txt','b.txt'])
73 >>> fullPath('/foo/bar.py',['a.txt','b.txt'])
60 ['/foo/a.txt', '/foo/b.txt']
74 ['/foo/a.txt', '/foo/b.txt']
61
75
62 >>> fullPath('/foo',['a.txt','b.txt'])
76 >>> fullPath('/foo',['a.txt','b.txt'])
63 ['/a.txt', '/b.txt']
77 ['/a.txt', '/b.txt']
64
78
65 If a single file is given, the output is still a list:
79 If a single file is given, the output is still a list:
66 >>> fullPath('/foo','a.txt')
80 >>> fullPath('/foo','a.txt')
67 ['/a.txt']
81 ['/a.txt']
68 """
82 """
69
83
70 files = utils.list_strings(files)
84 files = utils.list_strings(files)
71 base = os.path.split(startPath)[0]
85 base = os.path.split(startPath)[0]
72 return [ os.path.join(base,f) for f in files ]
86 return [ os.path.join(base,f) for f in files ]
General Comments 0
You need to be logged in to leave comments. Login now