Skip to content

Commit

Permalink
update test expectations for Python 3.13
Browse files Browse the repository at this point in the history
Python 3.13 no longer repeats the placeholder for options with multiple
aliases in the help message.  For example, rather than:

    -c CONFIG_FILE, --config CONFIG_FILE

it now outputs:

    -c, --config CONFIG_FILE

Update the regular expressions to account for both possibilities.

Fixes bw2#294
  • Loading branch information
mgorny committed Jul 12, 2024
1 parent ee77f44 commit c6a9742
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/test_configargparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ def testBasicCase2(self, use_groups=False):
' -h, --help \\s+ show this help message and exit\n'
' --genome GENOME \\s+ Path to genome file\n'
' -v\n'
' -g MY_CFG_FILE, --my-cfg-file MY_CFG_FILE\n'
' -d DBSNP, --dbsnp DBSNP\\s+\\[env var: DBSNP_PATH\\]\n'
' -f FRMT, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n\n'%OPTIONAL_ARGS_STRING +
' -g( MY_CFG_FILE)?, --my-cfg-file MY_CFG_FILE\n'
' -d( DBSNP)?, --dbsnp DBSNP\\s+\\[env var: DBSNP_PATH\\]\n'
' -f( FRMT)?, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n\n'%OPTIONAL_ARGS_STRING +
7*r'(.+\s*)')
else:
self.assertRegex(self.format_help(),
Expand All @@ -286,10 +286,10 @@ def testBasicCase2(self, use_groups=False):
'g1:\n'
' --genome GENOME \\s+ Path to genome file\n'
' -v\n'
' -g MY_CFG_FILE, --my-cfg-file MY_CFG_FILE\n\n'
' -g( MY_CFG_FILE)?, --my-cfg-file MY_CFG_FILE\n\n'
'g2:\n'
' -d DBSNP, --dbsnp DBSNP\\s+\\[env var: DBSNP_PATH\\]\n'
' -f FRMT, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n\n'%OPTIONAL_ARGS_STRING +
' -d( DBSNP)?, --dbsnp DBSNP\\s+\\[env var: DBSNP_PATH\\]\n'
' -f( FRMT)?, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n\n'%OPTIONAL_ARGS_STRING +
7*r'(.+\s*)')

self.assertParseArgsRaises("invalid choice: 'ZZZ'",
Expand Down Expand Up @@ -387,9 +387,9 @@ def testMutuallyExclusiveArgs(self):
' \\s*-f2 TYPE2_CFG_FILE\\)\\s+\\(-f FRMT \\| -b\\)\n\n'
'%s:\n'
' -h, --help show this help message and exit\n'
' -f1 TYPE1_CFG_FILE, --type1-cfg-file TYPE1_CFG_FILE\n'
' -f2 TYPE2_CFG_FILE, --type2-cfg-file TYPE2_CFG_FILE\n'
' -f FRMT, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n'
' -f1( TYPE1_CFG_FILE)?, --type1-cfg-file TYPE1_CFG_FILE\n'
' -f2( TYPE2_CFG_FILE)?, --type2-cfg-file TYPE2_CFG_FILE\n'
' -f( FRMT)?, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n'
' -b, --bam\\s+\\[env var: BAM_FORMAT\\]\n\n'
'group1:\n'
' --genome GENOME Path to genome file\n'
Expand Down Expand Up @@ -875,7 +875,7 @@ def testConstructor_ConfigFileArgs(self):
'usage: .* \\[-h\\] -c CONFIG_FILE --genome GENOME\n\n'
'%s:\n'
' -h, --help\\s+ show this help message and exit\n'
' -c CONFIG_FILE, --config CONFIG_FILE\\s+ my config file\n'
' -c( CONFIG_FILE)?, --config CONFIG_FILE\\s+ my config file\n'
' --genome GENOME\\s+ Path to genome file\n\n'%OPTIONAL_ARGS_STRING +
5*r'(.+\s*)')

Expand Down Expand Up @@ -935,8 +935,8 @@ def test_FormatHelp(self):
r'\[-w CONFIG_OUTPUT_PATH\]\s* --arg1\s+ARG1\s*\[--flag\]\s*'
'%s:\\s*'
'-h, --help \\s* show this help message and exit '
r'-c CONFIG_FILE, --config CONFIG_FILE\s+my config file '
r'-w CONFIG_OUTPUT_PATH, --write-config CONFIG_OUTPUT_PATH takes '
r'-c( CONFIG_FILE)?, --config CONFIG_FILE\s+my config file '
r'-w( CONFIG_OUTPUT_PATH)?, --write-config CONFIG_OUTPUT_PATH takes '
r'the current command line args and writes them '
r'out to a config file at the given path, then exits '
r'--arg1 ARG1 Arg1 help text '
Expand Down

0 comments on commit c6a9742

Please sign in to comment.