diff test/test_config.py @ 7913:6102ae426390

issue2551334 - get test suite running under windows Support windows style filepaths.
author John Rouillard <rouilj@ieee.org>
date Sun, 28 Apr 2024 09:17:54 -0400
parents 011941fcb598
children 1e38ca6fb16e
line wrap: on
line diff
--- a/test/test_config.py	Sun Apr 28 09:17:12 2024 -0400
+++ b/test/test_config.py	Sun Apr 28 09:17:54 2024 -0400
@@ -24,6 +24,8 @@
 import sys
 import unittest
 
+from os.path import normpath
+
 from roundup import configuration
 from roundup.backends import get_backend, have_backend
 from roundup.hyperdb import DatabaseError
@@ -218,14 +220,15 @@
     def testStaticFiles(self):
         config = configuration.CoreConfig()
 
+
+        if ("/tmp/bar" == normpath("/tmp/bar/")):
+            result_list = ["./foo", "/tmp/bar"]
+        else:
+            result_list = [".\\foo", "\\tmp\\bar"]
         self.assertEqual(None,
                 config._get_option('STATIC_FILES').set("foo /tmp/bar"))
-
-        self.assertEqual(config.STATIC_FILES,
-                         ["./foo", "/tmp/bar"])
-
-        self.assertEqual(config['STATIC_FILES'],
-                         ["./foo", "/tmp/bar"])
+        print(config.STATIC_FILES)
+        self.assertEqual(config.STATIC_FILES, result_list)
 
     def testIsolationLevel(self):
         config = configuration.CoreConfig()
@@ -982,7 +985,7 @@
 
         print(cm.exception)
         self.assertIn("'%' must be followed by '%' or '(', found: '% is invalid'", cm.exception.args[0])
-        self.assertIn("_test_instance/config.ini with section [main] at option admin_email", cm.exception.args[0])
+        self.assertIn(normpath("_test_instance/config.ini") + " with section [main] at option admin_email", cm.exception.args[0])
 
 
         from roundup.admin import AdminTool
@@ -993,7 +996,11 @@
             sys.argv=['main', '-i', self.dirname, 'get', 'tile', 'issue1']
             ret = admin.main()
 
-        expected_err = "Error in _test_instance/config.ini with section [main] at option admin_email: '%' must be followed by '%' or '(', found: '% is invalid'"
+        expected_err = ("Error in " +
+                        normpath("_test_instance/config.ini") +
+                        " with section [main] at option admin_email: '%' "
+                        "must be followed by '%' or '(', found: "
+                        "'% is invalid'")
 
         self.assertEqual(ret, 1)
         out = out.getvalue().strip()

Roundup Issue Tracker: http://roundup-tracker.org/