[Zope-Checkins] CVS: Packages/ZConfig/tests - testConfig.py:1.5
Fred L. Drake, Jr.
fdrake@acm.org
Thu, 17 Oct 2002 17:31:57 -0400
Update of /cvs-repository/Packages/ZConfig/tests
In directory cvs.zope.org:/tmp/cvs-serv28838
Modified Files:
testConfig.py
Log Message:
The previous fix to make this work on Windows didn't work for
everyone, but this one seems to be a better approach (*and* it works
for Tim!).
=== Packages/ZConfig/tests/testConfig.py 1.4 => 1.5 ===
--- Packages/ZConfig/tests/testConfig.py:1.4 Tue Oct 15 14:28:29 2002
+++ Packages/ZConfig/tests/testConfig.py Thu Oct 17 17:31:56 2002
@@ -14,9 +14,9 @@
"""Tests of the configuration data structures and loader."""
import os
-import sys
import tempfile
import unittest
+import urllib
import urlparse
import warnings
@@ -27,14 +27,14 @@
warnings.filterwarnings("ignore", r".*\bmktemp\b.*",
RuntimeWarning, __name__)
-if __name__ == "__main__":
+try:
+ __file__
+except NameError:
+ import sys
__file__ = sys.argv[0]
-d = os.path.abspath(os.path.dirname(__file__)) + "/input/"
-if os.sep == "\\":
- CONFIG_BASE = "file:" + d
-else:
- CONFIG_BASE = "file://" + d
+d = os.path.abspath(os.path.join(os.path.dirname(__file__), "input"))
+CONFIG_BASE = "file://%s/" % urllib.pathname2url(d)
class TestBase(unittest.TestCase):