File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 33# See test_cmd_line_script.py for testing of script execution
44
55import os
6+ import re
67import subprocess
78import sys
89import tempfile
@@ -54,11 +55,22 @@ def test_help(self):
5455 def test_help_env (self ):
5556 out = self .verify_valid_flag ('--help-env' )
5657 self .assertIn (b'PYTHONHOME' , out )
58+ # Env vars in each section should be sorted alphabetically
59+ # (ignoring underscores so PYTHON_FOO and PYTHONFOO intermix naturally)
60+ sort_key = lambda name : name .replace (b'_' , b'' ).lower ()
61+ sections = out .split (b'These variables have equivalent' )
62+ for section in sections :
63+ envvars = re .findall (rb'^(PYTHON\w+)' , section , re .MULTILINE )
64+ self .assertEqual (envvars , sorted (envvars , key = sort_key ),
65+ "env vars should be sorted alphabetically" )
5766
5867 @support .cpython_only
5968 def test_help_xoptions (self ):
6069 out = self .verify_valid_flag ('--help-xoptions' )
6170 self .assertIn (b'-X dev' , out )
71+ options = re .findall (rb'^-X (\w+)' , out , re .MULTILINE )
72+ self .assertEqual (options , sorted (options ),
73+ "options should be sorted alphabetically" )
6274
6375 @support .cpython_only
6476 def test_help_all (self ):
You can’t perform that action at this time.
0 commit comments