Skip to content

Commit ad7348e

Browse files
committed
issue2551334 - get test suite running under windows
Support windows style filepaths.
1 parent 439fd11 commit ad7348e

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

test/test_config.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import sys
2525
import unittest
2626

27+
from os.path import normpath
28+
2729
from roundup import configuration
2830
from roundup.backends import get_backend, have_backend
2931
from roundup.hyperdb import DatabaseError
@@ -218,14 +220,15 @@ def testWebSecretKey(self):
218220
def testStaticFiles(self):
219221
config = configuration.CoreConfig()
220222

223+
224+
if ("/tmp/bar" == normpath("/tmp/bar/")):
225+
result_list = ["./foo", "/tmp/bar"]
226+
else:
227+
result_list = [".\\foo", "\\tmp\\bar"]
221228
self.assertEqual(None,
222229
config._get_option('STATIC_FILES').set("foo /tmp/bar"))
223-
224-
self.assertEqual(config.STATIC_FILES,
225-
["./foo", "/tmp/bar"])
226-
227-
self.assertEqual(config['STATIC_FILES'],
228-
["./foo", "/tmp/bar"])
230+
print(config.STATIC_FILES)
231+
self.assertEqual(config.STATIC_FILES, result_list)
229232

230233
def testIsolationLevel(self):
231234
config = configuration.CoreConfig()
@@ -982,7 +985,7 @@ def testConfigValueInterpolateError(self):
982985

983986
print(cm.exception)
984987
self.assertIn("'%' must be followed by '%' or '(', found: '% is invalid'", cm.exception.args[0])
985-
self.assertIn("_test_instance/config.ini with section [main] at option admin_email", cm.exception.args[0])
988+
self.assertIn(normpath("_test_instance/config.ini") + " with section [main] at option admin_email", cm.exception.args[0])
986989

987990

988991
from roundup.admin import AdminTool
@@ -993,7 +996,11 @@ def testConfigValueInterpolateError(self):
993996
sys.argv=['main', '-i', self.dirname, 'get', 'tile', 'issue1']
994997
ret = admin.main()
995998

996-
expected_err = "Error in _test_instance/config.ini with section [main] at option admin_email: '%' must be followed by '%' or '(', found: '% is invalid'"
999+
expected_err = ("Error in " +
1000+
normpath("_test_instance/config.ini") +
1001+
" with section [main] at option admin_email: '%' "
1002+
"must be followed by '%' or '(', found: "
1003+
"'% is invalid'")
9971004

9981005
self.assertEqual(ret, 1)
9991006
out = out.getvalue().strip()

0 commit comments

Comments
 (0)