diff options
author | Guido van Rossum <guido@python.org> | 2001-10-24 20:42:55 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-10-24 20:42:55 (GMT) |
commit | e2ae77b8b8a62e648bb1864a9b36ef3280984404 (patch) | |
tree | e03ad6f126a16529b2fb43671903e357bcb05835 /Lib/test | |
parent | c6ac8a78f668123ec5c2c3d5a824e7886e9a1c60 (diff) | |
download | cpython-e2ae77b8b8a62e648bb1864a9b36ef3280984404.zip cpython-e2ae77b8b8a62e648bb1864a9b36ef3280984404.tar.gz cpython-e2ae77b8b8a62e648bb1864a9b36ef3280984404.tar.bz2 |
SF patch #474590 -- RISC OS support
Diffstat (limited to 'Lib/test')
-rwxr-xr-x | Lib/test/regrtest.py | 46 | ||||
-rwxr-xr-x | Lib/test/test_imageop.py | 10 | ||||
-rw-r--r-- | Lib/test/test_import.py | 6 | ||||
-rw-r--r-- | Lib/test/test_mailbox.py | 2 | ||||
-rw-r--r-- | Lib/test/test_mhlib.py | 4 | ||||
-rw-r--r-- | Lib/test/test_minidom.py | 4 | ||||
-rw-r--r-- | Lib/test/test_pkg.py | 54 | ||||
-rw-r--r-- | Lib/test/test_pkgimport.py | 4 | ||||
-rw-r--r-- | Lib/test/test_repr.py | 14 | ||||
-rw-r--r-- | Lib/test/test_rgbimg.py | 10 | ||||
-rw-r--r-- | Lib/test/test_sax.py | 15 | ||||
-rw-r--r-- | Lib/test/test_signal.py | 4 | ||||
-rw-r--r-- | Lib/test/test_tokenize.py | 2 | ||||
-rw-r--r-- | Lib/test/test_urllib2.py | 5 | ||||
-rw-r--r-- | Lib/test/test_zipfile.py | 8 |
15 files changed, 118 insertions, 70 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 0c5d85a..b2bb7ac 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -156,7 +156,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, pass for i in range(len(args)): # Strip trailing ".py" from arguments - if args[i][-3:] == '.py': + if args[i][-3:] == os.extsep+'py': args[i] = args[i][:-3] stdtests = STDTESTS[:] nottests = NOTTESTS[:] @@ -272,7 +272,7 @@ def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS): names = os.listdir(testdir) tests = [] for name in names: - if name[:5] == "test_" and name[-3:] == ".py": + if name[:5] == "test_" and name[-3:] == os.extsep+"py": modname = name[:-3] if modname not in stdtests and modname not in nottests: tests.append(modname) @@ -576,6 +576,48 @@ _expectations = { test_winreg test_winsound """, + 'riscos': + """ + test_al + test_asynchat + test_bsddb + test_cd + test_cl + test_commands + test_crypt + test_dbm + test_dl + test_fcntl + test_fork1 + test_gdbm + test_gl + test_grp + test_imgfile + test_largefile + test_linuxaudiodev + test_locale + test_mmap + test_nis + test_ntpath + test_openpty + test_poll + test_popen2 + test_pty + test_pwd + test_socket_ssl + test_socketserver + test_strop + test_sunaudiodev + test_sundry + test_thread + test_threaded_import + test_threadedtempfile + test_threading + test_timing + test_unicode_file + test_winreg + test_winsound + """, } class _ExpectedSkips: diff --git a/Lib/test/test_imageop.py b/Lib/test/test_imageop.py index 7a6981e..ff83c45 100755 --- a/Lib/test/test_imageop.py +++ b/Lib/test/test_imageop.py @@ -7,17 +7,17 @@ from test_support import verbose, unlink -import imageop, uu +import imageop, uu, os def main(use_rgbimg=1): # Create binary test files - uu.decode(get_qualified_path('testrgb.uue'), 'test.rgb') + uu.decode(get_qualified_path('testrgb'+os.extsep+'uue'), 'test'+os.extsep+'rgb') if use_rgbimg: - image, width, height = getrgbimage('test.rgb') + image, width, height = getrgbimage('test'+os.extsep+'rgb') else: - image, width, height = getimage('test.rgb') + image, width, height = getimage('test'+os.extsep+'rgb') # Return the selected part of image, which should by width by height # in size and consist of pixels of psize bytes. @@ -114,7 +114,7 @@ def main(use_rgbimg=1): image = imageop.grey22grey (grey2image, width, height) # Cleanup - unlink('test.rgb') + unlink('test'+os.extsep+'rgb') def getrgbimage(name): """return a tuple consisting of image (in 'imgfile' format but diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index b2e3fb6..305c297 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -18,11 +18,11 @@ import double_const # don't blink -- that *was* the test def test_with_extension(ext): # ext normally ".py"; perhaps ".pyw" source = TESTFN + ext - pyo = TESTFN + ".pyo" + pyo = TESTFN + os.extsep + "pyo" if sys.platform.startswith('java'): pyc = TESTFN + "$py.class" else: - pyc = TESTFN + ".pyc" + pyc = TESTFN + os.extsep + "pyc" f = open(source, "w") print >> f, "# This tests Python's ability to import a", ext, "file." @@ -63,7 +63,7 @@ def test_with_extension(ext): # ext normally ".py"; perhaps ".pyw" sys.path.insert(0, os.curdir) try: - test_with_extension(".py") + test_with_extension(os.extsep + "py") if sys.platform.startswith("win"): for ext in ".PY", ".Py", ".pY", ".pyw", ".PYW", ".pYw": test_with_extension(ext) diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index 4e23398..bb75e64 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -42,7 +42,7 @@ class MaildirTestCase(unittest.TestCase): t = int(time.time() % 1000000) pid = self._counter self._counter += 1 - filename = "%s.%s.myhostname.mydomain" % (t, pid) + filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain")) tmpname = os.path.join(self._dir, "tmp", filename) newname = os.path.join(self._dir, dir, filename) fp = open(tmpname, "w") diff --git a/Lib/test/test_mhlib.py b/Lib/test/test_mhlib.py index 9d5f101..91c1a1a 100644 --- a/Lib/test/test_mhlib.py +++ b/Lib/test/test_mhlib.py @@ -12,8 +12,8 @@ import os, StringIO import sys import mhlib -if sys.platform.startswith("win"): - raise TestSkipped("test_mhlib skipped on Windows -- " +if sys.platform.startswith("win") or sys.platform=="riscos": + raise TestSkipped("test_mhlib skipped on %s -- "%sys.platform + "too many Unix assumptions") _mhroot = TESTFN+"_MH" diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index 2a290aa..ab985b8 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -4,7 +4,7 @@ from xml.dom.minidom import parse, Node, Document, parseString from xml.dom import HierarchyRequestErr import xml.parsers.expat -import os.path +import os import sys import traceback from test_support import verbose @@ -13,7 +13,7 @@ if __name__ == "__main__": base = sys.argv[0] else: base = __file__ -tstfile = os.path.join(os.path.dirname(base), "test.xml") +tstfile = os.path.join(os.path.dirname(base), "test"+os.extsep+"xml") del base def confirm(test, testname = "Test"): diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py index f699af40..c9e771d 100644 --- a/Lib/test/test_pkg.py +++ b/Lib/test/test_pkg.py @@ -1,7 +1,7 @@ # Test packages (dotted-name import) import sys, os, tempfile, traceback -from os import mkdir, rmdir # Can't test if these fail +from os import mkdir, rmdir, extsep # Can't test if these fail del mkdir, rmdir from test_support import verify, verbose, TestFailed @@ -77,15 +77,15 @@ def runtest(hier, code): # Test descriptions tests = [ - ("t1", [("t1", None), ("t1 __init__.py", "")], "import t1"), + ("t1", [("t1", None), ("t1 __init__"+os.extsep+"py", "")], "import t1"), ("t2", [ ("t2", None), - ("t2 __init__.py", "'doc for t2'; print __name__, 'loading'"), + ("t2 __init__"+os.extsep+"py", "'doc for t2'; print __name__, 'loading'"), ("t2 sub", None), - ("t2 sub __init__.py", ""), + ("t2 sub __init__"+os.extsep+"py", ""), ("t2 sub subsub", None), - ("t2 sub subsub __init__.py", "print __name__, 'loading'; spam = 1"), + ("t2 sub subsub __init__"+os.extsep+"py", "print __name__, 'loading'; spam = 1"), ], """ import t2 @@ -111,11 +111,11 @@ print dir() ("t3", [ ("t3", None), - ("t3 __init__.py", "print __name__, 'loading'"), + ("t3 __init__"+os.extsep+"py", "print __name__, 'loading'"), ("t3 sub", None), - ("t3 sub __init__.py", ""), + ("t3 sub __init__"+os.extsep+"py", ""), ("t3 sub subsub", None), - ("t3 sub subsub __init__.py", "print __name__, 'loading'; spam = 1"), + ("t3 sub subsub __init__"+os.extsep+"py", "print __name__, 'loading'; spam = 1"), ], """ import t3.sub.subsub @@ -126,15 +126,15 @@ reload(t3.sub.subsub) """), ("t4", [ - ("t4.py", "print 'THIS SHOULD NOT BE PRINTED (t4.py)'"), + ("t4"+os.extsep+"py", "print 'THIS SHOULD NOT BE PRINTED (t4"+os.extsep+"py)'"), ("t4", None), - ("t4 __init__.py", "print __name__, 'loading'"), - ("t4 sub.py", "print 'THIS SHOULD NOT BE PRINTED (sub.py)'"), + ("t4 __init__"+os.extsep+"py", "print __name__, 'loading'"), + ("t4 sub"+os.extsep+"py", "print 'THIS SHOULD NOT BE PRINTED (sub"+os.extsep+"py)'"), ("t4 sub", None), - ("t4 sub __init__.py", ""), - ("t4 sub subsub.py", "print 'THIS SHOULD NOT BE PRINTED (subsub.py)'"), + ("t4 sub __init__"+os.extsep+"py", ""), + ("t4 sub subsub"+os.extsep+"py", "print 'THIS SHOULD NOT BE PRINTED (subsub"+os.extsep+"py)'"), ("t4 sub subsub", None), - ("t4 sub subsub __init__.py", "print __name__, 'loading'; spam = 1"), + ("t4 sub subsub __init__"+os.extsep+"py", "print __name__, 'loading'; spam = 1"), ], """ from t4.sub.subsub import * @@ -143,9 +143,9 @@ print "t4.sub.subsub.spam =", spam ("t5", [ ("t5", None), - ("t5 __init__.py", "import t5.foo"), - ("t5 string.py", "print __name__, 'loading'; spam = 1"), - ("t5 foo.py", + ("t5 __init__"+os.extsep+"py", "import t5.foo"), + ("t5 string"+os.extsep+"py", "print __name__, 'loading'; spam = 1"), + ("t5 foo"+os.extsep+"py", "print __name__, 'loading'; import string; print string.spam"), ], """ @@ -160,10 +160,10 @@ print fixdir(dir(t5.string)) ("t6", [ ("t6", None), - ("t6 __init__.py", "__all__ = ['spam', 'ham', 'eggs']"), - ("t6 spam.py", "print __name__, 'loading'"), - ("t6 ham.py", "print __name__, 'loading'"), - ("t6 eggs.py", "print __name__, 'loading'"), + ("t6 __init__"+os.extsep+"py", "__all__ = ['spam', 'ham', 'eggs']"), + ("t6 spam"+os.extsep+"py", "print __name__, 'loading'"), + ("t6 ham"+os.extsep+"py", "print __name__, 'loading'"), + ("t6 eggs"+os.extsep+"py", "print __name__, 'loading'"), ], """ import t6 @@ -174,15 +174,15 @@ print dir() """), ("t7", [ - ("t7.py", "print 'Importing t7.py'"), + ("t7"+os.extsep+"py", "print 'Importing t7"+os.extsep+"py'"), ("t7", None), - ("t7 __init__.py", "print __name__, 'loading'"), - ("t7 sub.py", "print 'THIS SHOULD NOT BE PRINTED (sub.py)'"), + ("t7 __init__"+os.extsep+"py", "print __name__, 'loading'"), + ("t7 sub"+os.extsep+"py", "print 'THIS SHOULD NOT BE PRINTED (sub"+os.extsep+"py)'"), ("t7 sub", None), - ("t7 sub __init__.py", ""), - ("t7 sub subsub.py", "print 'THIS SHOULD NOT BE PRINTED (subsub.py)'"), + ("t7 sub __init__"+os.extsep+"py", ""), + ("t7 sub subsub"+os.extsep+"py", "print 'THIS SHOULD NOT BE PRINTED (subsub"+os.extsep+"py)'"), ("t7 sub subsub", None), - ("t7 sub subsub __init__.py", "print __name__, 'loading'; spam = 1"), + ("t7 sub subsub __init__"+os.extsep+"py", "print __name__, 'loading'; spam = 1"), ], """ t7, sub, subsub = None, None, None diff --git a/Lib/test/test_pkgimport.py b/Lib/test/test_pkgimport.py index 72889f9..8c7a99b 100644 --- a/Lib/test/test_pkgimport.py +++ b/Lib/test/test_pkgimport.py @@ -23,8 +23,8 @@ class TestImport(unittest.TestCase): self.package_dir = os.path.join(self.test_dir, self.package_name) os.mkdir(self.package_dir) - open(os.path.join(self.package_dir, '__init__.py'), 'w') - self.module_path = os.path.join(self.package_dir, 'foo.py') + open(os.path.join(self.package_dir, '__init__'+os.extsep+'py'), 'w') + self.module_path = os.path.join(self.package_dir, 'foo'+os.extsep+'py') def tearDown(self): for file in os.listdir(self.package_dir): diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py index 1c63e4d..e7b564e 100644 --- a/Lib/test/test_repr.py +++ b/Lib/test/test_repr.py @@ -173,9 +173,9 @@ class LongReprTest(unittest.TestCase): self.subpkgname = os.path.join(longname, longname) # Make the package and subpackage os.mkdir(self.pkgname) - touch(os.path.join(self.pkgname, '__init__.py')) + touch(os.path.join(self.pkgname, '__init__'+os.extsep+'py')) os.mkdir(self.subpkgname) - touch(os.path.join(self.subpkgname, '__init__.py')) + touch(os.path.join(self.subpkgname, '__init__'+os.extsep+'py')) # Remember where we are self.here = os.getcwd() sys.path.insert(0, self.here) @@ -195,14 +195,14 @@ class LongReprTest(unittest.TestCase): def test_module(self): eq = self.assertEquals - touch(os.path.join(self.subpkgname, self.pkgname + '.py')) + touch(os.path.join(self.subpkgname, self.pkgname + os.extsep + 'py')) from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import areallylongpackageandmodulenametotestreprtruncation eq(repr(areallylongpackageandmodulenametotestreprtruncation), "<module 'areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation' from '%s'>" % areallylongpackageandmodulenametotestreprtruncation.__file__) def test_type(self): eq = self.assertEquals - touch(os.path.join(self.subpkgname, 'foo.py'), '''\ + touch(os.path.join(self.subpkgname, 'foo'+os.extsep+'py'), '''\ class foo(object): pass ''') @@ -216,7 +216,7 @@ class foo(object): pass def test_class(self): - touch(os.path.join(self.subpkgname, 'bar.py'), '''\ + touch(os.path.join(self.subpkgname, 'bar'+os.extsep+'py'), '''\ class bar: pass ''') @@ -225,7 +225,7 @@ class bar: "<class areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation.bar.bar at 0x")) def test_instance(self): - touch(os.path.join(self.subpkgname, 'baz.py'), '''\ + touch(os.path.join(self.subpkgname, 'baz'+os.extsep+'py'), '''\ class baz: pass ''') @@ -236,7 +236,7 @@ class baz: def test_method(self): eq = self.assertEquals - touch(os.path.join(self.subpkgname, 'qux.py'), '''\ + touch(os.path.join(self.subpkgname, 'qux'+os.extsep+'py'), '''\ class aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: def amethod(self): pass ''') diff --git a/Lib/test/test_rgbimg.py b/Lib/test/test_rgbimg.py index f2622e4..b632cd0 100644 --- a/Lib/test/test_rgbimg.py +++ b/Lib/test/test_rgbimg.py @@ -25,9 +25,9 @@ def testimg(rgb_file, raw_file): os.unlink('@.rgb') table = [ - ('testrgb.uue', 'test.rgb'), - ('testimg.uue', 'test.rawimg'), - ('testimgr.uue', 'test.rawimg.rev'), + ('testrgb'+os.extsep+'uue', 'test'+os.extsep+'rgb'), + ('testimg'+os.extsep+'uue', 'test'+os.extsep+'rawimg'), + ('testimgr'+os.extsep+'uue', 'test'+os.extsep+'rawimg'+os.extsep+'rev'), ] for source, target in table: source = findfile(source) @@ -43,13 +43,13 @@ ttob = rgbimg.ttob(0) if ttob != 0: raise error, 'ttob should start out as zero' -testimg('test.rgb', 'test.rawimg') +testimg('test'+os.extsep+'rgb', 'test'+os.extsep+'rawimg') ttob = rgbimg.ttob(1) if ttob != 0: raise error, 'ttob should be zero' -testimg('test.rgb', 'test.rawimg.rev') +testimg('test'+os.extsep+'rgb', 'test'+os.extsep+'rawimg'+os.extsep+'rev') ttob = rgbimg.ttob(0) if ttob != 1: diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index dcf57d4..32b7609 100644 --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -13,6 +13,7 @@ from xml.sax.expatreader import create_parser from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl from cStringIO import StringIO from test_support import verify, verbose, TestFailed, findfile +import os # ===== Utilities @@ -228,7 +229,7 @@ def test_expat_file(): xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) - parser.parse(open(findfile("test.xml"))) + parser.parse(open(findfile("test"+os.extsep+"xml"))) return result.getvalue() == xml_test_out @@ -349,7 +350,7 @@ def test_expat_nsattrs_wattr(): # ===== InputSource support -xml_test_out = open(findfile("test.xml.out")).read() +xml_test_out = open(findfile("test"+os.extsep+"xml"+os.extsep+"out")).read() def test_expat_inpsource_filename(): parser = create_parser() @@ -357,7 +358,7 @@ def test_expat_inpsource_filename(): xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) - parser.parse(findfile("test.xml")) + parser.parse(findfile("test"+os.extsep+"xml")) return result.getvalue() == xml_test_out @@ -367,7 +368,7 @@ def test_expat_inpsource_sysid(): xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) - parser.parse(InputSource(findfile("test.xml"))) + parser.parse(InputSource(findfile("test"+os.extsep+"xml"))) return result.getvalue() == xml_test_out @@ -378,7 +379,7 @@ def test_expat_inpsource_stream(): parser.setContentHandler(xmlgen) inpsrc = InputSource() - inpsrc.setByteStream(open(findfile("test.xml"))) + inpsrc.setByteStream(open(findfile("test"+os.extsep+"xml"))) parser.parse(inpsrc) return result.getvalue() == xml_test_out @@ -625,9 +626,9 @@ def make_test_output(): xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) - parser.parse(findfile("test.xml")) + parser.parse(findfile("test"+os.extsep+"xml")) - outf = open(findfile("test.xml.out"), "w") + outf = open(findfile("test"+os.extsep+"xml"+os.extsep+"out"), "w") outf.write(result.getvalue()) outf.close() diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index a6c32b4..05bdcab 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -4,8 +4,8 @@ import signal import os import sys -if sys.platform[:3] in ('win', 'os2'): - raise TestSkipped, "Can't test signal on %s" % sys.platform[:3] +if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos': + raise TestSkipped, "Can't test signal on %s" % sys.platform if verbose: x = '-x' diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py index a0713d1..7ac5624 100644 --- a/Lib/test/test_tokenize.py +++ b/Lib/test/test_tokenize.py @@ -3,7 +3,7 @@ import tokenize, os, sys if verbose: print 'starting...' -file = open(findfile('tokenize_tests.py')) +file = open(findfile('tokenize_tests'+os.extsep+'py')) tokenize.tokenize(file.readline) if verbose: print 'finished' diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index 129bf2c..bb4fedb 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -19,6 +19,11 @@ if fname[1:2] == ":": # urllib.pathname2url works, unfortunately... if os.name == 'mac': fname = '/' + fname.replace(':', '/') +elif os.name == 'riscos': + import string + fname = os.expand(fname) + fname = fname.translate(string.maketrans("/.", "./")) + file_url = "file://%s" % fname f = urllib2.urlopen(file_url) diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index 87e99ec..480aeed 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -2,19 +2,19 @@ import zlib # implied prerequisite import zipfile, os, StringIO, tempfile from test_support import TestFailed -srcname = "junk9630.tmp" -zipname = "junk9708.tmp" +srcname = "junk9630"+os.extsep+"tmp" +zipname = "junk9708"+os.extsep+"tmp" def zipTest(f, compression, srccontents): zip = zipfile.ZipFile(f, "w", compression) # Create the ZIP archive - zip.write(srcname, "another.name") + zip.write(srcname, "another"+os.extsep+"name") zip.write(srcname, srcname) zip.close() zip = zipfile.ZipFile(f, "r", compression) # Read the ZIP archive readData2 = zip.read(srcname) - readData1 = zip.read("another.name") + readData1 = zip.read("another"+os.extsep+"name") zip.close() if readData1 != srccontents or readData2 != srccontents: |