Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(129247)

Side by Side Diff: Lib/test/test_doctest.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_cmd_line.py ('k') | Lib/test/test_faulthandler.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """ 1 """
2 Test script for doctest. 2 Test script for doctest.
3 """ 3 """
4 4
5 from test import support 5 from test import support
6 import doctest 6 import doctest
7 import functools 7 import functools
8 import os 8 import os
9 import sys 9 import sys
10 10
(...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after
2700 Exception raised: 2700 Exception raised:
2701 Traceback (most recent call last): 2701 Traceback (most recent call last):
2702 File ... 2702 File ...
2703 compileflags, 1), test.globs) 2703 compileflags, 1), test.globs)
2704 File "<doctest foo-bär@baz[0]>", line 1, in <module> 2704 File "<doctest foo-bär@baz[0]>", line 1, in <module>
2705 raise Exception('clé') 2705 raise Exception('clé')
2706 Exception: clé 2706 Exception: clé
2707 TestResults(failed=1, attempted=1) 2707 TestResults(failed=1, attempted=1)
2708 """ 2708 """
2709 2709
2710 def test_CLI(): r""" 2710 if sys.platform == 'ios':
2711 # Mobile platforms can't invoke doctest from the command line,
2712 # so skip this test.
2713 pass
2714 else:
2715 def test_CLI(): r"""
2711 The doctest module can be used to run doctests against an arbitrary file. 2716 The doctest module can be used to run doctests against an arbitrary file.
2712 These tests test this CLI functionality. 2717 These tests test this CLI functionality.
2713 2718
2714 We'll use the support module's script_helpers for this, and write a test files 2719 We'll use the support module's script_helpers for this, and write a test files
2715 to a temp dir to run the command against. Due to a current limitation in 2720 to a temp dir to run the command against. Due to a current limitation in
2716 script_helpers, though, we need a little utility function to turn the returned 2721 script_helpers, though, we need a little utility function to turn the returned
2717 output into something we can doctest against: 2722 output into something we can doctest against:
2718 2723
2719 >>> def normalize(s): 2724 >>> def normalize(s):
2720 ... return '\n'.join(s.decode().splitlines()) 2725 ... return '\n'.join(s.decode().splitlines())
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
2962 r = tracer.results() 2967 r = tracer.results()
2963 print('Writing coverage results...') 2968 print('Writing coverage results...')
2964 r.write_results(show_missing=True, summary=True, 2969 r.write_results(show_missing=True, summary=True,
2965 coverdir=coverdir) 2970 coverdir=coverdir)
2966 2971
2967 if __name__ == '__main__': 2972 if __name__ == '__main__':
2968 if '-c' in sys.argv: 2973 if '-c' in sys.argv:
2969 test_coverage('/tmp/doctest.cover') 2974 test_coverage('/tmp/doctest.cover')
2970 else: 2975 else:
2971 test_main() 2976 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_cmd_line.py ('k') | Lib/test/test_faulthandler.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+