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

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

Issue 13041: argparse: terminal width is not detected properly
Patch Set: Created 1 year, 3 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/argparse.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Author: Steven J. Bethard <steven.bethard@gmail.com>. 1 # Author: Steven J. Bethard <steven.bethard@gmail.com>.
2 2
3 import codecs 3 import codecs
4 import inspect 4 import inspect
5 import os 5 import os
6 import shutil 6 import shutil
7 import stat 7 import stat
8 import sys 8 import sys
9 import textwrap 9 import textwrap
10 import tempfile 10 import tempfile
(...skipping 13 matching lines...) Expand all
24 print('') 24 print('')
25 print(repr(obj1)) 25 print(repr(obj1))
26 print(repr(obj2)) 26 print(repr(obj2))
27 print(obj1) 27 print(obj1)
28 print(obj2) 28 print(obj2)
29 super(TestCase, self).assertEqual(obj1, obj2) 29 super(TestCase, self).assertEqual(obj1, obj2)
30 30
31 def setUp(self): 31 def setUp(self):
32 # The tests assume that line wrapping occurs at 80 columns, but this 32 # The tests assume that line wrapping occurs at 80 columns, but this
33 # behaviour can be overridden by setting the COLUMNS environment 33 # behaviour can be overridden by setting the COLUMNS environment
34 # variable. To ensure that this assumption is true, unset COLUMNS. 34 # variable. To ensure that this width is used, set COLUMNS=80.
35 env = support.EnvironmentVarGuard() 35 env = support.EnvironmentVarGuard()
36 env.unset("COLUMNS") 36 env['COLUMNS'] = '80'
37 self.addCleanup(env.__exit__) 37 self.addCleanup(env.__exit__)
38 38
39 39
40 class TempDirMixin(object): 40 class TempDirMixin(object):
41 41
42 def setUp(self): 42 def setUp(self):
43 self.temp_dir = tempfile.mkdtemp() 43 self.temp_dir = tempfile.mkdtemp()
44 self.old_dir = os.getcwd() 44 self.old_dir = os.getcwd()
45 os.chdir(self.temp_dir) 45 os.chdir(self.temp_dir)
46 46
(...skipping 4721 matching lines...) Expand 10 before | Expand all | Expand 10 after
4768 DeprecationWarning)): 4768 DeprecationWarning)):
4769 support.run_unittest(__name__) 4769 support.run_unittest(__name__)
4770 # Remove global references to avoid looking like we have refleaks. 4770 # Remove global references to avoid looking like we have refleaks.
4771 RFile.seen = {} 4771 RFile.seen = {}
4772 WFile.seen = set() 4772 WFile.seen = set()
4773 4773
4774 4774
4775 4775
4776 if __name__ == '__main__': 4776 if __name__ == '__main__':
4777 test_main() 4777 test_main()
OLDNEW
« no previous file with comments | « Lib/argparse.py ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7