summaryrefslogtreecommitdiff
path: root/dev-python/ConfigArgParse/files/ConfigArgParse-1.7-py313.patch
blob: a079f37a18e6bd51418bf74b614b2a17f9e66686 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
From c6a974211f1a13d492bb807ff6d07cefcc948a87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Fri, 12 Jul 2024 08:15:40 +0200
Subject: [PATCH 1/2] update test expectations for Python 3.13

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 #294
---
 tests/test_configargparse.py | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/tests/test_configargparse.py b/tests/test_configargparse.py
index 288e082..e325afd 100644
--- a/tests/test_configargparse.py
+++ b/tests/test_configargparse.py
@@ -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(),
@@ -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'",
@@ -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'
@@ -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*)')
 
@@ -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 '

From 5e9f442374bc6d9707a43df13aaff684dff6b535 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Fri, 12 Jul 2024 08:25:30 +0200
Subject: [PATCH 2/2] skip exit_on_error* tests to fix 3.13 test failures

Skip `exit_on_error*` tests from `test.test_argparse` to avoid test
failures on Python 3.13.  The `exit_on_error=False` semantics
is not supported by ConfigArgParse at the moment.
---
 tests/test_configargparse.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/test_configargparse.py b/tests/test_configargparse.py
index e325afd..9718d86 100644
--- a/tests/test_configargparse.py
+++ b/tests/test_configargparse.py
@@ -1533,7 +1533,8 @@ def testYAMLConfigFileParser_w_ArgumentParser_parsed_values(self):
     test_argparse_source_code = test_argparse_source_code.replace(
         'argparse.ArgumentParser', 'configargparse.ArgumentParser').replace(
         'TestHelpFormattingMetaclass', '_TestHelpFormattingMetaclass').replace(
-        'test_main', '_test_main')
+        'test_main', '_test_main').replace(
+        'test_exit_on_error', '_test_exit_on_error')
 
     # pytest tries to collect tests from TestHelpFormattingMetaclass, and
     # test_main, and raises a warning when it finds it's not a test class