[Python-checkins] distutils2: fdrake's suggested improvements implemented

tarek.ziade python-checkins at python.org
Sun Sep 19 10:20:21 CEST 2010


tarek.ziade pushed 8fbadd7511f7 to distutils2:

http://hg.python.org/distutils2/rev/8fbadd7511f7
changeset:   604:8fbadd7511f7
user:        Konrad Delong <konryd at gmail.com>
date:        Tue Jul 27 14:59:11 2010 +0200
summary:     fdrake's suggested improvements implemented
files:       src/distutils2/tests/test_test.py

diff --git a/src/distutils2/tests/test_test.py b/src/distutils2/tests/test_test.py
--- a/src/distutils2/tests/test_test.py
+++ b/src/distutils2/tests/test_test.py
@@ -11,28 +11,29 @@
 except NameError:
     from distutils2._backport import any
 
-EXPECTED_OUTPUT_RE = '''\
-FAIL: test_blah \\(myowntestmodule.SomeTest\\)
+EXPECTED_OUTPUT_RE = r'''FAIL: test_blah \(myowntestmodule.SomeTest\)
 ----------------------------------------------------------------------
-Traceback \\(most recent call last\\):
-  File ".+/myowntestmodule.py", line \\d+, in test_blah
-    self.fail\\("horribly"\\)
+Traceback \(most recent call last\):
+  File ".+/myowntestmodule.py", line \d+, in test_blah
+    self.fail\("horribly"\)
 AssertionError: horribly
 '''
 
+here = os.path.dirname(os.path.abspath(__file__))
+
+
 class TestTest(TempdirManager, unittest.TestCase):
 
     def setUp(self):
         super(TestTest, self).setUp()
 
-        distutils2path = join(__file__, '..', '..', '..')
-        distutils2path = os.path.abspath(distutils2path)
+        distutils2path = os.path.dirname(os.path.dirname(here))
         self.old_pythonpath = os.environ.get('PYTHONPATH', '')
-        os.environ['PYTHONPATH'] = distutils2path + ":" + self.old_pythonpath
+        os.environ['PYTHONPATH'] = distutils2path + os.pathsep + self.old_pythonpath
 
     def tearDown(self):
+        os.environ['PYTHONPATH'] = self.old_pythonpath
         super(TestTest, self).tearDown()
-        os.environ['PYTHONPATH'] = self.old_pythonpath
 
     def assert_re_match(self, pattern, string):
         def quote(s):
@@ -86,5 +87,4 @@
         pass
 
 def test_suite():
-    suite = [unittest.makeSuite(TestTest)]
-    return unittest.TestSuite(suite)
+    return unittest.makeSuite(TestTest)

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list