Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_tools.py @ 79691:05c8928362ee
Merge __next__ method link fixes with 3.3.
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Fri, 12 Oct 2012 13:46:37 +0300 |
| parents | c18b15f2609e |
| children | 01df1f7841b2 |
| rev | line source |
|---|---|
|
75281
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
1 """Tests for scripts in the Tools directory. |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
2 |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
3 This file contains regression tests for some of the scripts found in the |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
4 Tools directory of a Python checkout or tarball, such as reindent.py. |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
5 """ |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
6 |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
7 import os |
|
76106
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
8 import sys |
| 76877 | 9 import importlib.machinery |
|
75281
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
10 import unittest |
|
76251
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
11 from unittest import mock |
|
75281
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
12 import sysconfig |
|
76134
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
13 import tempfile |
|
75281
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
14 from test import support |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
15 from test.script_helper import assert_python_ok |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
16 |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
17 if not sysconfig.is_python_build(): |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
18 # XXX some installers do contain the tools, should we detect that |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
19 # and run the tests in that case too? |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
20 raise unittest.SkipTest('test irrelevant for an installed Python') |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
21 |
|
78955
5493299df0a0
backport from the trunk, to fix test_tools with srcdir != builddir
doko@ubuntu.com
parents:
76134
diff
changeset
|
22 basepath = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), |
|
5493299df0a0
backport from the trunk, to fix test_tools with srcdir != builddir
doko@ubuntu.com
parents:
76134
diff
changeset
|
23 'Tools') |
|
76106
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
24 scriptsdir = os.path.join(basepath, 'scripts') |
|
75281
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
25 |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
26 |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
27 class ReindentTests(unittest.TestCase): |
|
76106
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
28 script = os.path.join(scriptsdir, 'reindent.py') |
|
75281
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
29 |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
30 def test_noargs(self): |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
31 assert_python_ok(self.script) |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
32 |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
33 def test_help(self): |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
34 rc, out, err = assert_python_ok(self.script, '-h') |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
35 self.assertEqual(out, b'') |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
36 self.assertGreater(err, b'') |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
37 |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
38 |
|
76106
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
39 class TestSundryScripts(unittest.TestCase): |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
40 # At least make sure the rest don't have syntax errors. When tests are |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
41 # added for a script it should be added to the whitelist below. |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
42 |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
43 # scripts that have independent tests. |
|
76251
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
44 whitelist = ['reindent.py', 'pdeps.py', 'gprof2html'] |
|
76106
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
45 # scripts that can't be imported without running |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
46 blacklist = ['make_ctype.py'] |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
47 # scripts that use windows-only modules |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
48 windows_only = ['win_add2path.py'] |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
49 # blacklisted for other reasons |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
50 other = ['analyze_dxp.py'] |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
51 |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
52 skiplist = blacklist + whitelist + windows_only + other |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
53 |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
54 def setUp(self): |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
55 cm = support.DirsOnSysPath(scriptsdir) |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
56 cm.__enter__() |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
57 self.addCleanup(cm.__exit__) |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
58 |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
59 def test_sundry(self): |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
60 for fn in os.listdir(scriptsdir): |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
61 if fn.endswith('.py') and fn not in self.skiplist: |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
62 __import__(fn[:-3]) |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
63 |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
64 @unittest.skipIf(sys.platform != "win32", "Windows-only test") |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
65 def test_sundry_windows(self): |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
66 for fn in self.windows_only: |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
67 __import__(fn[:-3]) |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
68 |
|
76108
058f9a9f97cd
test_tools fix: don't import analyze_dxp if no _thread module
R David Murray <rdmurray@bitdance.com>
parents:
76106
diff
changeset
|
69 @unittest.skipIf(not support.threading, "test requires _thread module") |
|
76106
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
70 def test_analyze_dxp_import(self): |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
71 if hasattr(sys, 'getdxp'): |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
72 import analyze_dxp |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
73 else: |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
74 with self.assertRaises(RuntimeError): |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
75 import analyze_dxp |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
76 |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
77 |
|
76134
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
78 class PdepsTests(unittest.TestCase): |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
79 |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
80 @classmethod |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
81 def setUpClass(self): |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
82 path = os.path.join(scriptsdir, 'pdeps.py') |
| 76877 | 83 loader = importlib.machinery.SourceFileLoader('pdeps', path) |
| 84 self.pdeps = loader.load_module() | |
|
76134
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
85 |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
86 @classmethod |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
87 def tearDownClass(self): |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
88 if 'pdeps' in sys.modules: |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
89 del sys.modules['pdeps'] |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
90 |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
91 def test_process_errors(self): |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
92 # Issue #14492: m_import.match(line) can be None. |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
93 with tempfile.TemporaryDirectory() as tmpdir: |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
94 fn = os.path.join(tmpdir, 'foo') |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
95 with open(fn, 'w') as stream: |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
96 stream.write("#!/this/will/fail") |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
97 self.pdeps.process(fn, {}) |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
98 |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
99 def test_inverse_attribute_error(self): |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
100 # Issue #14492: this used to fail with an AttributeError. |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
101 self.pdeps.inverse({'a': []}) |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
102 |
|
e9b8115c5b25
#14492: fix some bugs in Tools/scripts/pdeps.py.
R David Murray <rdmurray@bitdance.com>
parents:
76108
diff
changeset
|
103 |
|
76251
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
104 class Gprof2htmlTests(unittest.TestCase): |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
105 |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
106 def setUp(self): |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
107 path = os.path.join(scriptsdir, 'gprof2html.py') |
| 76877 | 108 loader = importlib.machinery.SourceFileLoader('gprof2html', path) |
| 109 self.gprof = loader.load_module() | |
|
76251
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
110 oldargv = sys.argv |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
111 def fixup(): |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
112 sys.argv = oldargv |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
113 self.addCleanup(fixup) |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
114 sys.argv = [] |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
115 |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
116 def test_gprof(self): |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
117 # Issue #14508: this used to fail with an NameError. |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
118 with mock.patch.object(self.gprof, 'webbrowser') as wmock, \ |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
119 tempfile.TemporaryDirectory() as tmpdir: |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
120 fn = os.path.join(tmpdir, 'abc') |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
121 open(fn, 'w').close() |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
122 sys.argv = ['gprof2html', fn] |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
123 self.gprof.main() |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
124 self.assertTrue(wmock.open.called) |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
125 |
|
73fba223c0a5
#14508: make gprof2html script runnable under python3
R David Murray <rdmurray@bitdance.com>
parents:
76134
diff
changeset
|
126 |
|
76814
f9344a3eaaa6
Issue #14695: Run Tools/parser/test_unparse.py as part of test_tools.
Mark Dickinson <mdickinson@enthought.com>
parents:
76251
diff
changeset
|
127 # Run the tests in Tools/parser/test_unparse.py |
|
f9344a3eaaa6
Issue #14695: Run Tools/parser/test_unparse.py as part of test_tools.
Mark Dickinson <mdickinson@enthought.com>
parents:
76251
diff
changeset
|
128 with support.DirsOnSysPath(os.path.join(basepath, 'parser')): |
|
76828
dbfacec7e368
Issue #14742: Don't include DirectoryTestCase from test_unparse in test_tools until we can speed it up.
Mark Dickinson <mdickinson@enthought.com>
parents:
76814
diff
changeset
|
129 from test_unparse import UnparseTestCase |
|
77614
0e5a698d3c4c
Issue #14742: test_unparse now only checks a limited number of files unless the 'cpu' resource is specified.
Mark Dickinson <mdickinson@enthought.com>
parents:
76877
diff
changeset
|
130 from test_unparse import DirectoryTestCase |
|
76814
f9344a3eaaa6
Issue #14695: Run Tools/parser/test_unparse.py as part of test_tools.
Mark Dickinson <mdickinson@enthought.com>
parents:
76251
diff
changeset
|
131 |
|
f9344a3eaaa6
Issue #14695: Run Tools/parser/test_unparse.py as part of test_tools.
Mark Dickinson <mdickinson@enthought.com>
parents:
76251
diff
changeset
|
132 |
|
75281
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
133 def test_main(): |
|
76106
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
134 support.run_unittest(*[obj for obj in globals().values() |
|
62dde5dd475e
#14490, #14491: add 'sundry'-style import tests for Tools/scripts.
R David Murray <rdmurray@bitdance.com>
parents:
75281
diff
changeset
|
135 if isinstance(obj, type)]) |
|
75281
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
136 |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
137 |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
138 if __name__ == '__main__': |
|
2887f5a97075
Add test file for scripts in Tools (#13447).
Éric Araujo <merwok@netwok.org>
parents:
diff
changeset
|
139 unittest.main() |
