diff options
author | Walter Dörwald <walter@livinglogic.de> | 2003-05-01 17:45:56 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2003-05-01 17:45:56 (GMT) |
commit | 21d3a32b99c5763444c34c189ef653ac9745f3c4 (patch) | |
tree | 766baf21fbced41da1e22490829fe938420600e0 /Lib/test/test_pep277.py | |
parent | 90437c03f2215acebffec9669316b40d46bd9757 (diff) | |
download | cpython-21d3a32b99c5763444c34c189ef653ac9745f3c4.zip cpython-21d3a32b99c5763444c34c189ef653ac9745f3c4.tar.gz cpython-21d3a32b99c5763444c34c189ef653ac9745f3c4.tar.bz2 |
Combine the functionality of test_support.run_unittest()
and test_support.run_classtests() into run_unittest()
and use it wherever possible.
Also don't use "from test.test_support import ...", but
"from test import test_support" in a few spots.
From SF patch #662807.
Diffstat (limited to 'Lib/test/test_pep277.py')
-rw-r--r-- | Lib/test/test_pep277.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/Lib/test/test_pep277.py b/Lib/test/test_pep277.py index 7173b89..9dc232c 100644 --- a/Lib/test/test_pep277.py +++ b/Lib/test/test_pep277.py @@ -1,9 +1,9 @@ # Test the Unicode versions of normal file functions # open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir import os, unittest -from test.test_support import TESTFN, TestSkipped, TestFailed, run_suite +from test import test_support if not os.path.supports_unicode_filenames: - raise TestSkipped, "test works only on NT+" + raise test_support.TestSkipped, "test works only on NT+" filenames = [ 'abc', @@ -28,11 +28,11 @@ def deltree(dirname): os.rmdir(dirname) class UnicodeFileTests(unittest.TestCase): - files = [os.path.join(TESTFN, f) for f in filenames] + files = [os.path.join(test_support.TESTFN, f) for f in filenames] def setUp(self): try: - os.mkdir(TESTFN) + os.mkdir(test_support.TESTFN) except OSError: pass for name in self.files: @@ -42,17 +42,17 @@ class UnicodeFileTests(unittest.TestCase): os.stat(name) def tearDown(self): - deltree(TESTFN) + deltree(test_support.TESTFN) def _apply_failure(self, fn, filename, expected_exception, check_fn_in_exception = True): try: fn(filename) - raise TestFailed("Expected to fail calling '%s(%r)'" + raise test_support.TestFailed("Expected to fail calling '%s(%r)'" % (fn.__name__, filename)) except expected_exception, details: if check_fn_in_exception and details.filename != filename: - raise TestFailed("Function '%s(%r) failed with " + raise test_support.TestFailed("Function '%s(%r) failed with " "bad filename in the exception: %r" % (fn.__name__, filename, details.filename)) @@ -77,9 +77,9 @@ class UnicodeFileTests(unittest.TestCase): os.stat(name) def test_listdir(self): - f1 = os.listdir(TESTFN) + f1 = os.listdir(test_support.TESTFN) f1.sort() - f2 = os.listdir(unicode(TESTFN,"mbcs")) + f2 = os.listdir(unicode(test_support.TESTFN,"mbcs")) f2.sort() print f1 print f2 @@ -90,7 +90,7 @@ class UnicodeFileTests(unittest.TestCase): os.rename("tmp",name) def test_directory(self): - dirname = os.path.join(TESTFN,u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') + dirname = os.path.join(test_support.TESTFN,u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') filename = u'\xdf-\u66e8\u66e9\u66eb' oldwd = os.getcwd() os.mkdir(dirname) @@ -104,12 +104,10 @@ class UnicodeFileTests(unittest.TestCase): os.rmdir(dirname) def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(UnicodeFileTests)) try: - run_suite(suite) + test_support.run_unittest(UnicodeFileTests) finally: - deltree(TESTFN) + deltree(test_support.TESTFN) if __name__ == "__main__": test_main() |