Repository: bw2/ConfigArgParse (language: python)

Issue:
Tests do not pass on python2 and python 3.5 anymore
It looks like since d6717c7cb4ac0573ce804c14d26534539fb3691a there are format strings in the tests. But f-strings were introduced in python3.6, so we can’t test python 3.5 and 2.7 anymore. This is an issue if you want to keep supporting older versions of python, like your pretty blue label states.





Discussion / hints:

Fix patch:
diff --git a/setup.py b/setup.py
index eec7236..d5bc289 100644
--- a/setup.py
+++ b/setup.py
@@ -75,6 +75,7 @@ def launch_http_server(directory):
 tests_require = [
     'mock',
     'PyYAML',
+    'pytest',
 ]
 
 
@@ -113,5 +114,6 @@ def launch_http_server(directory):
     tests_require=tests_require,
     extras_require = {
         'yaml': ["PyYAML"],
+        'test': tests_require,
     }
 )


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..05766d1
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,35 @@
+name: unit tests
+
+on:
+  push:
+    branches: [ master ]
+    tags: 
+      - '*'
+  pull_request:
+    branches: [ master ]
+
+jobs: 
+  test:
+    name: ${{ matrix.os }} py${{ matrix.python-version }}
+    runs-on: ${{ matrix.os }} 
+
+    strategy:
+      matrix:
+        os: [ubuntu-latest, windows-latest, macos-latest]
+        python-version: ['2.7','3.5','3.6','3.7','3.8','3.9','3.10.0-beta.3']
+      fail-fast: false
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python-version }}
+
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip setuptools wheel tox 
+          python -m pip install '.[test]'
+      
+      - name: Run tests
+        run: pytest
\ No newline at end of file
diff --git a/tests/test_configargparse.py b/tests/test_configargparse.py
index f4db3b2..e693f2d 100644
--- a/tests/test_configargparse.py
+++ b/tests/test_configargparse.py
@@ -257,13 +257,13 @@ def testBasicCase2(self, use_groups=False):
                 '\\s+\\[-d DBSNP\\]\\s+\\[-f FRMT\\]\\s+vcf \\[vcf ...\\]\n\n'
                 'positional arguments:\n'
                 '  vcf \\s+ Variant file\\(s\\)\n\n'
-                f"{OPTIONAL_ARGS_STRING}:\n"
+                '%s:\n'
                 '  -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' +
+                '  -f FRMT, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n\n'%OPTIONAL_ARGS_STRING +
                 7*r'(.+\s*)')
         else:
             self.assertRegex(self.format_help(),
@@ -271,7 +271,7 @@ def testBasicCase2(self, use_groups=False):
                 '\\s+\\[-d DBSNP\\]\\s+\\[-f FRMT\\]\\s+vcf \\[vcf ...\\]\n\n'
                 'positional arguments:\n'
                 '  vcf \\s+ Variant file\\(s\\)\n\n'
-                f"{OPTIONAL_ARGS_STRING}:\n"
+                '%s:\n'
                 '  -h, --help \\s+ show this help message and exit\n\n'
                 'g1:\n'
                 '  --genome GENOME \\s+ Path to genome file\n'
@@ -279,7 +279,7 @@ def testBasicCase2(self, use_groups=False):
                 '  -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' +
+                '  -f FRMT, --format FRMT\\s+\\[env var: OUTPUT_FORMAT\\]\n\n'%OPTIONAL_ARGS_STRING +
                 7*r'(.+\s*)')
 
         self.assertParseArgsRaises("invalid choice: 'ZZZ'",
@@ -375,7 +375,7 @@ def testMutuallyExclusiveArgs(self):
         self.assertRegex(self.format_help(),
             r'usage: .* \[-h\] --genome GENOME \[-v\]\s+ \(-f1 TYPE1_CFG_FILE \|'
             ' \\s*-f2 TYPE2_CFG_FILE\\)\\s+\\(-f FRMT \\| -b\\)\n\n'
-            f"{OPTIONAL_ARGS_STRING}:\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'
@@ -383,7 +383,7 @@ def testMutuallyExclusiveArgs(self):
             '  -b, --bam\\s+\\[env var: BAM_FORMAT\\]\n\n'
             'group1:\n'
             '  --genome GENOME       Path to genome file\n'
-            '  -v\n\n' +
+            '  -v\n\n'%OPTIONAL_ARGS_STRING +
             5*r'(.+\s*)')
         config_file.close()
 
@@ -863,10 +863,10 @@ def testConstructor_ConfigFileArgs(self):
 
         self.assertRegex(self.format_help(),
             'usage: .* \\[-h\\] -c CONFIG_FILE --genome GENOME\n\n'
-            f"{OPTIONAL_ARGS_STRING}:\n"
+            '%s:\n'
             '  -h, --help\\s+ show this help message and exit\n'
             '  -c CONFIG_FILE, --config CONFIG_FILE\\s+ my config file\n'
-            '  --genome GENOME\\s+ Path to genome file\n\n' +
+            '  --genome GENOME\\s+ Path to genome file\n\n'%OPTIONAL_ARGS_STRING +
             5*r'(.+\s*)')
 
         # just run print_values() to make sure it completes and returns None
@@ -923,7 +923,7 @@ def test_FormatHelp(self):
         self.assertRegex(self.format_help(),
             r'usage: .* \[-h\] -c CONFIG_FILE\s+'
             r'\[-w CONFIG_OUTPUT_PATH\]\s* --arg1\s+ARG1\s*\[--flag\]\s*'
-            f"{OPTIONAL_ARGS_STRING}:\\s*"
+            '%s:\\s*'
             '-h, --help \\s* show this help message and exit\n\\s*'
             r'-c CONFIG_FILE, --config CONFIG_FILE\s+my config file\s*'
             r'-w CONFIG_OUTPUT_PATH, --write-config CONFIG_OUTPUT_PATH\s*takes\s*'
@@ -937,7 +937,7 @@ def test_FormatHelp(self):
             r'\(for details, see syntax at https://goo.gl/R74nmi\).\s*'
             r'If an arg is specified in more than\s*one place, then '
             r'commandline values\s*override config file values which override\s*'
-            r'defaults.'
+            r'defaults.'%OPTIONAL_ARGS_STRING
         )
 
     def test_FormatHelpProg(self):