summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2007-08-16 14:35:24 (GMT)
committerSkip Montanaro <skip@pobox.com>2007-08-16 14:35:24 (GMT)
commit7a98be2efbdc44a6271e3bf6117a1e6c77828414 (patch)
tree64b6306494f992605ef5bd854dfc9e4922f8b967 /Lib
parentc5aba174477a4bdbda31d859ce407c6ee7cef293 (diff)
downloadcpython-7a98be2efbdc44a6271e3bf6117a1e6c77828414.zip
cpython-7a98be2efbdc44a6271e3bf6117a1e6c77828414.tar.gz
cpython-7a98be2efbdc44a6271e3bf6117a1e6c77828414.tar.bz2
Remove RISCOS support
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/command/install_lib.py5
-rw-r--r--Lib/dumbdbm.py6
-rw-r--r--Lib/fileinput.py2
-rw-r--r--Lib/os.py4
-rw-r--r--Lib/pkgutil.py6
-rw-r--r--Lib/site.py2
-rwxr-xr-xLib/test/regrtest.py4
-rw-r--r--Lib/test/test_exceptions.py4
-rw-r--r--Lib/test/test_import.py22
-rw-r--r--Lib/test/test_mailbox.py2
-rw-r--r--Lib/test/test_minidom.py2
-rw-r--r--Lib/test/test_normalization.py2
-rw-r--r--Lib/test/test_old_mailbox.py2
-rw-r--r--Lib/test/test_pkg.py54
-rw-r--r--Lib/test/test_pkgimport.py4
-rw-r--r--Lib/test/test_repr.py14
-rw-r--r--Lib/test/test_runpy.py8
-rw-r--r--Lib/test/test_sax.py10
-rw-r--r--Lib/test/test_support.py4
-rw-r--r--Lib/test/test_tokenize.py4
-rw-r--r--Lib/test/test_zipfile.py32
-rw-r--r--Lib/test/test_zipimport.py2
-rw-r--r--Lib/whichdb.py12
23 files changed, 100 insertions, 107 deletions
diff --git a/Lib/distutils/command/install_lib.py b/Lib/distutils/command/install_lib.py
index 65d25f7..4efaf9c 100644
--- a/Lib/distutils/command/install_lib.py
+++ b/Lib/distutils/command/install_lib.py
@@ -9,10 +9,7 @@ from distutils.errors import DistutilsOptionError
# Extension for Python source files.
-if hasattr(os, 'extsep'):
- PYTHON_SOURCE_EXTENSION = os.extsep + "py"
-else:
- PYTHON_SOURCE_EXTENSION = ".py"
+PYTHON_SOURCE_EXTENSION = ".py"
class install_lib (Command):
diff --git a/Lib/dumbdbm.py b/Lib/dumbdbm.py
index 6cfda1c..07fd1b3 100644
--- a/Lib/dumbdbm.py
+++ b/Lib/dumbdbm.py
@@ -51,14 +51,14 @@ class _Database(UserDict.DictMixin):
# where key is the string key, pos is the offset into the dat
# file of the associated value's first byte, and siz is the number
# of bytes in the associated value.
- self._dirfile = filebasename + _os.extsep + 'dir'
+ self._dirfile = filebasename + '.dir'
# The data file is a binary file pointed into by the directory
# file, and holds the values associated with keys. Each value
# begins at a _BLOCKSIZE-aligned byte offset, and is a raw
# binary 8-bit string value.
- self._datfile = filebasename + _os.extsep + 'dat'
- self._bakfile = filebasename + _os.extsep + 'bak'
+ self._datfile = filebasename + '.dat'
+ self._bakfile = filebasename + '.bak'
# The index is an in-memory dict, mirroring the directory file.
self._index = None # maps keys to (pos, siz) pairs
diff --git a/Lib/fileinput.py b/Lib/fileinput.py
index 53e7c09..0080f78 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -315,7 +315,7 @@ class FileInput:
else:
if self._inplace:
self._backupfilename = (
- self._filename + (self._backup or os.extsep+"bak"))
+ self._filename + (self._backup or ".bak"))
try: os.unlink(self._backupfilename)
except os.error: pass
# The next few lines may raise IOError
diff --git a/Lib/os.py b/Lib/os.py
index f13850b..48bcea2 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -7,7 +7,6 @@ This exports:
- os.curdir is a string representing the current directory ('.' or ':')
- os.pardir is a string representing the parent directory ('..' or '::')
- os.sep is the (or a most common) pathname separator ('/' or ':' or '\\')
- - os.extsep is the extension separator ('.' or '/')
- os.altsep is the alternate pathname separator (None or '/')
- os.pathsep is the component separator used in $PATH etc
- os.linesep is the line separator in text files ('\r' or '\n' or '\r\n')
@@ -131,8 +130,7 @@ else:
raise ImportError, 'no os specific module found'
sys.modules['os.path'] = path
-from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep,
- devnull)
+from os.path import curdir, pardir, sep, pathsep, defpath, altsep, devnull
del _names
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py
index 5b6b169..6e93a3e 100644
--- a/Lib/pkgutil.py
+++ b/Lib/pkgutil.py
@@ -510,10 +510,8 @@ def extend_path(path, name):
return path
pname = os.path.join(*name.split('.')) # Reconstitute as relative path
- # Just in case os.extsep != '.'
- sname = os.extsep.join(name.split('.'))
- sname_pkg = sname + os.extsep + "pkg"
- init_py = "__init__" + os.extsep + "py"
+ sname_pkg = name + ".pkg"
+ init_py = "__init__.py"
path = path[:] # Start with a copy of the existing path
diff --git a/Lib/site.py b/Lib/site.py
index 1d3183a..47a46f6 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -167,7 +167,7 @@ def addsitedir(sitedir, known_paths=None):
return
names.sort()
for name in names:
- if name.endswith(os.extsep + "pth"):
+ if name.endswith(".pth"):
addpackage(sitedir, name, known_paths)
if reset:
known_paths = None
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 07c49ad..e7596a5 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -509,7 +509,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:] == os.extsep+"py":
+ if name[:5] == "test_" and name[-3:] == ".py":
modname = name[:-3]
if modname not in stdtests and modname not in nottests:
tests.append(modname)
@@ -799,7 +799,7 @@ def findtestdir():
return testdir
def removepy(name):
- if name.endswith(os.extsep + "py"):
+ if name.endswith(".py"):
name = name[:-3]
return name
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 0988098..ed1d6dc 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -155,7 +155,7 @@ class ExceptionTests(unittest.TestCase):
exc, err, tb = sys.exc_info()
co = tb.tb_frame.f_code
self.assertEquals(co.co_name, "test_capi1")
- self.assert_(co.co_filename.endswith('test_exceptions'+os.extsep+'py'))
+ self.assert_(co.co_filename.endswith('test_exceptions.py'))
else:
self.fail("Expected exception")
@@ -167,7 +167,7 @@ class ExceptionTests(unittest.TestCase):
exc, err, tb = sys.exc_info()
co = tb.tb_frame.f_code
self.assertEquals(co.co_name, "__init__")
- self.assert_(co.co_filename.endswith('test_exceptions'+os.extsep+'py'))
+ self.assert_(co.co_filename.endswith('test_exceptions.py'))
co2 = tb.tb_frame.f_back.f_code
self.assertEquals(co2.co_name, "test_capi2")
else:
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index 193de40..884d052 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -10,10 +10,10 @@ from test.test_support import unlink
def remove_files(name):
- for f in (name + os.extsep + "py",
- name + os.extsep + "pyc",
- name + os.extsep + "pyo",
- name + os.extsep + "pyw",
+ for f in (name + ".py",
+ name + ".pyc",
+ name + ".pyo",
+ name + ".pyw",
name + "$py.class"):
if os.path.exists(f):
os.remove(f)
@@ -39,11 +39,11 @@ class ImportTest(unittest.TestCase):
def test_with_extension(ext):
# ext normally ".py"; perhaps ".pyw"
source = TESTFN + ext
- pyo = TESTFN + os.extsep + "pyo"
+ pyo = TESTFN + ".pyo"
if sys.platform.startswith('java'):
pyc = TESTFN + "$py.class"
else:
- pyc = TESTFN + os.extsep + "pyc"
+ pyc = TESTFN + ".pyc"
f = open(source, "w")
print("# This tests Python's ability to import a", ext, "file.", file=f)
@@ -71,7 +71,7 @@ class ImportTest(unittest.TestCase):
sys.path.insert(0, os.curdir)
try:
- test_with_extension(os.extsep + "py")
+ test_with_extension(".py")
if sys.platform.startswith("win"):
for ext in ".PY", ".Py", ".pY", ".pyw", ".PYW", ".pYw":
test_with_extension(ext)
@@ -86,7 +86,7 @@ class ImportTest(unittest.TestCase):
def test_module_with_large_stack(self, module='longlist'):
# create module w/list of 65000 elements to test bug #561858
- filename = module + os.extsep + 'py'
+ filename = module + '.py'
# create a file with a list of 65000 elements
f = open(filename, 'w+')
@@ -110,13 +110,13 @@ class ImportTest(unittest.TestCase):
# cleanup
del sys.path[-1]
- for ext in 'pyc', 'pyo':
- fname = module + os.extsep + ext
+ for ext in '.pyc', '.pyo':
+ fname = module + ext
if os.path.exists(fname):
os.unlink(fname)
def test_failing_import_sticks(self):
- source = TESTFN + os.extsep + "py"
+ source = TESTFN + ".py"
f = open(source, "w")
print("a = 1/0", file=f)
f.close()
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
index 59def94..64ed07c 100644
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -1687,7 +1687,7 @@ class MaildirTestCase(unittest.TestCase):
t = int(time.time() % 1000000)
pid = self._counter
self._counter += 1
- filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain"))
+ filename = ".".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_minidom.py b/Lib/test/test_minidom.py
index fb3b098..d1a72bd 100644
--- a/Lib/test/test_minidom.py
+++ b/Lib/test/test_minidom.py
@@ -20,7 +20,7 @@ if __name__ == "__main__":
base = sys.argv[0]
else:
base = __file__
-tstfile = os.path.join(os.path.dirname(base), "test"+os.extsep+"xml")
+tstfile = os.path.join(os.path.dirname(base), "test.xml")
del base
# The tests of DocumentType importing use these helpers to construct
diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py
index 1331e51..f07a87d 100644
--- a/Lib/test/test_normalization.py
+++ b/Lib/test/test_normalization.py
@@ -5,7 +5,7 @@ import sys
import os
from unicodedata import normalize
-TESTDATAFILE = "NormalizationTest" + os.extsep + "txt"
+TESTDATAFILE = "NormalizationTest.txt"
TESTDATAURL = "http://www.unicode.org/Public/4.1.0/ucd/" + TESTDATAFILE
class RangeError(Exception):
diff --git a/Lib/test/test_old_mailbox.py b/Lib/test/test_old_mailbox.py
index 3176310..4b6a735 100644
--- a/Lib/test/test_old_mailbox.py
+++ b/Lib/test/test_old_mailbox.py
@@ -45,7 +45,7 @@ class MaildirTestCase(unittest.TestCase):
t = int(time.time() % 1000000)
pid = self._counter
self._counter += 1
- filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain"))
+ filename = ".".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_pkg.py b/Lib/test/test_pkg.py
index 907359b..467ca97 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, extsep # Can't test if these fail
+from os import mkdir, rmdir # Can't test if these fail
del mkdir, rmdir
from test.test_support import verify, verbose, TestFailed
@@ -77,15 +77,15 @@ def runtest(hier, code):
# Test descriptions
tests = [
- ("t1", [("t1", None), ("t1 __init__"+os.extsep+"py", "")], "import t1"),
+ ("t1", [("t1", None), ("t1 __init__.py", "")], "import t1"),
("t2", [
("t2", None),
- ("t2 __init__"+os.extsep+"py", "'doc for t2'; print(__name__, 'loading')"),
+ ("t2 __init__.py", "'doc for t2'; print(__name__, 'loading')"),
("t2 sub", None),
- ("t2 sub __init__"+os.extsep+"py", ""),
+ ("t2 sub __init__.py", ""),
("t2 sub subsub", None),
- ("t2 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"),
+ ("t2 sub subsub __init__.py", "print(__name__, 'loading'); spam = 1"),
],
"""
import t2
@@ -111,11 +111,11 @@ print(dir())
("t3", [
("t3", None),
- ("t3 __init__"+os.extsep+"py", "print(__name__, 'loading')"),
+ ("t3 __init__.py", "print(__name__, 'loading')"),
("t3 sub", None),
- ("t3 sub __init__"+os.extsep+"py", ""),
+ ("t3 sub __init__.py", ""),
("t3 sub subsub", None),
- ("t3 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"),
+ ("t3 sub subsub __init__.py", "print(__name__, 'loading'); spam = 1"),
],
"""
import t3.sub.subsub
@@ -123,15 +123,15 @@ print(t3.__name__, t3.sub.__name__, t3.sub.subsub.__name__)
"""),
("t4", [
- ("t4"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (t4"+os.extsep+"py)')"),
+ ("t4.py", "print('THIS SHOULD NOT BE PRINTED (t4.py)')"),
("t4", None),
- ("t4 __init__"+os.extsep+"py", "print(__name__, 'loading')"),
- ("t4 sub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (sub"+os.extsep+"py)')"),
+ ("t4 __init__.py", "print(__name__, 'loading')"),
+ ("t4 sub.py", "print('THIS SHOULD NOT BE PRINTED (sub.py)')"),
("t4 sub", None),
- ("t4 sub __init__"+os.extsep+"py", ""),
- ("t4 sub subsub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (subsub"+os.extsep+"py)')"),
+ ("t4 sub __init__.py", ""),
+ ("t4 sub subsub.py", "print('THIS SHOULD NOT BE PRINTED (subsub.py)')"),
("t4 sub subsub", None),
- ("t4 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"),
+ ("t4 sub subsub __init__.py", "print(__name__, 'loading'); spam = 1"),
],
"""
from t4.sub.subsub import *
@@ -140,9 +140,9 @@ print("t4.sub.subsub.spam =", spam)
("t5", [
("t5", None),
- ("t5 __init__"+os.extsep+"py", "import t5.foo"),
- ("t5 string"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"),
- ("t5 foo"+os.extsep+"py",
+ ("t5 __init__.py", "import t5.foo"),
+ ("t5 string.py", "print(__name__, 'loading'); spam = 1"),
+ ("t5 foo.py",
"print(__name__, 'loading'); from . import string; print(string.spam)"),
],
"""
@@ -157,10 +157,10 @@ print(fixdir(dir(t5.string)))
("t6", [
("t6", None),
- ("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')"),
+ ("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')"),
],
"""
import t6
@@ -171,15 +171,15 @@ print(dir())
"""),
("t7", [
- ("t7"+os.extsep+"py", "print('Importing t7"+os.extsep+"py')"),
+ ("t7.py", "print('Importing t7.py')"),
("t7", None),
- ("t7 __init__"+os.extsep+"py", "print(__name__, 'loading')"),
- ("t7 sub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (sub"+os.extsep+"py)')"),
+ ("t7 __init__.py", "print(__name__, 'loading')"),
+ ("t7 sub.py", "print('THIS SHOULD NOT BE PRINTED (sub.py)')"),
("t7 sub", None),
- ("t7 sub __init__"+os.extsep+"py", ""),
- ("t7 sub subsub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (subsub"+os.extsep+"py)')"),
+ ("t7 sub __init__.py", ""),
+ ("t7 sub subsub.py", "print('THIS SHOULD NOT BE PRINTED (subsub.py)')"),
("t7 sub subsub", None),
- ("t7 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"),
+ ("t7 sub subsub __init__.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 789f4d3..574d1db 100644
--- a/Lib/test/test_pkgimport.py
+++ b/Lib/test/test_pkgimport.py
@@ -22,8 +22,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__'+os.extsep+'py'), 'w')
- self.module_path = os.path.join(self.package_dir, 'foo'+os.extsep+'py')
+ open(os.path.join(self.package_dir, '__init__.py'), 'w')
+ self.module_path = os.path.join(self.package_dir, 'foo.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 d4db894..7e8292b 100644
--- a/Lib/test/test_repr.py
+++ b/Lib/test/test_repr.py
@@ -205,10 +205,10 @@ class LongReprTest(unittest.TestCase):
# Make the package and subpackage
shutil.rmtree(self.pkgname, ignore_errors=True)
os.mkdir(self.pkgname)
- touch(os.path.join(self.pkgname, '__init__'+os.extsep+'py'))
+ touch(os.path.join(self.pkgname, '__init__.py'))
shutil.rmtree(self.subpkgname, ignore_errors=True)
os.mkdir(self.subpkgname)
- touch(os.path.join(self.subpkgname, '__init__'+os.extsep+'py'))
+ touch(os.path.join(self.subpkgname, '__init__.py'))
# Remember where we are
self.here = os.getcwd()
sys.path.insert(0, self.here)
@@ -228,7 +228,7 @@ class LongReprTest(unittest.TestCase):
def test_module(self):
eq = self.assertEquals
- touch(os.path.join(self.subpkgname, self.pkgname + os.extsep + 'py'))
+ touch(os.path.join(self.subpkgname, self.pkgname + '.py'))
from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import areallylongpackageandmodulenametotestreprtruncation
eq(repr(areallylongpackageandmodulenametotestreprtruncation),
"<module '%s' from '%s'>" % (areallylongpackageandmodulenametotestreprtruncation.__name__, areallylongpackageandmodulenametotestreprtruncation.__file__))
@@ -236,7 +236,7 @@ class LongReprTest(unittest.TestCase):
def test_type(self):
eq = self.assertEquals
- touch(os.path.join(self.subpkgname, 'foo'+os.extsep+'py'), '''\
+ touch(os.path.join(self.subpkgname, 'foo.py'), '''\
class foo(object):
pass
''')
@@ -250,7 +250,7 @@ class foo(object):
pass
def test_class(self):
- touch(os.path.join(self.subpkgname, 'bar'+os.extsep+'py'), '''\
+ touch(os.path.join(self.subpkgname, 'bar.py'), '''\
class bar:
pass
''')
@@ -259,7 +259,7 @@ class bar:
self.assertEquals(repr(bar.bar), "<class '%s.bar'>" % bar.__name__)
def test_instance(self):
- touch(os.path.join(self.subpkgname, 'baz'+os.extsep+'py'), '''\
+ touch(os.path.join(self.subpkgname, 'baz.py'), '''\
class baz:
pass
''')
@@ -270,7 +270,7 @@ class baz:
def test_method(self):
eq = self.assertEquals
- touch(os.path.join(self.subpkgname, 'qux'+os.extsep+'py'), '''\
+ touch(os.path.join(self.subpkgname, 'qux.py'), '''\
class aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa:
def amethod(self): pass
''')
diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py
index d10e40f..0fcec1e 100644
--- a/Lib/test/test_runpy.py
+++ b/Lib/test/test_runpy.py
@@ -103,14 +103,14 @@ class RunModuleTest(unittest.TestCase):
def _add_pkg_dir(self, pkg_dir):
os.mkdir(pkg_dir)
- pkg_fname = os.path.join(pkg_dir, "__init__"+os.extsep+"py")
+ pkg_fname = os.path.join(pkg_dir, "__init__.py")
pkg_file = open(pkg_fname, "w")
pkg_file.close()
return pkg_fname
def _make_pkg(self, source, depth):
pkg_name = "__runpy_pkg__"
- test_fname = "runpy_test"+os.extsep+"py"
+ test_fname = "runpy_test.py"
pkg_dir = sub_dir = tempfile.mkdtemp()
if verbose: print(" Package tree in:", sub_dir)
sys.path.insert(0, pkg_dir)
@@ -182,7 +182,7 @@ class RunModuleTest(unittest.TestCase):
parent_dir = module_dir
module_dir = os.path.join(module_dir, pkg_name)
# Add sibling module
- sibling_fname = os.path.join(module_dir, "sibling"+os.extsep+"py")
+ sibling_fname = os.path.join(module_dir, "sibling.py")
sibling_file = open(sibling_fname, "w")
sibling_file.close()
if verbose: print(" Added sibling module:", sibling_fname)
@@ -193,7 +193,7 @@ class RunModuleTest(unittest.TestCase):
cousin_dir = os.path.join(uncle_dir, "cousin")
self._add_pkg_dir(cousin_dir)
if verbose: print(" Added cousin package:", cousin_dir)
- nephew_fname = os.path.join(cousin_dir, "nephew"+os.extsep+"py")
+ nephew_fname = os.path.join(cousin_dir, "nephew.py")
nephew_file = open(nephew_fname, "w")
nephew_file.close()
if verbose: print(" Added nephew module:", nephew_fname)
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index e2639fa..a411bfd 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -311,7 +311,7 @@ class XMLFilterBaseTest(unittest.TestCase):
#
# ===========================================================================
-xml_test_out = open(findfile("test"+os.extsep+"xml"+os.extsep+"out")).read()
+xml_test_out = open(findfile("test.xml.out")).read()
class ExpatReaderTest(XmlTestBase):
@@ -323,7 +323,7 @@ class ExpatReaderTest(XmlTestBase):
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
- parser.parse(open(findfile("test"+os.extsep+"xml")))
+ parser.parse(open(findfile("test.xml")))
self.assertEquals(result.getvalue(), xml_test_out)
@@ -452,7 +452,7 @@ class ExpatReaderTest(XmlTestBase):
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
- parser.parse(findfile("test"+os.extsep+"xml"))
+ parser.parse(findfile("test.xml"))
self.assertEquals(result.getvalue(), xml_test_out)
@@ -462,7 +462,7 @@ class ExpatReaderTest(XmlTestBase):
xmlgen = XMLGenerator(result)
parser.setContentHandler(xmlgen)
- parser.parse(InputSource(findfile("test"+os.extsep+"xml")))
+ parser.parse(InputSource(findfile("test.xml")))
self.assertEquals(result.getvalue(), xml_test_out)
@@ -473,7 +473,7 @@ class ExpatReaderTest(XmlTestBase):
parser.setContentHandler(xmlgen)
inpsrc = InputSource()
- inpsrc.setByteStream(open(findfile("test"+os.extsep+"xml")))
+ inpsrc.setByteStream(open(findfile("test.xml")))
parser.parse(inpsrc)
self.assertEquals(result.getvalue(), xml_test_out)
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 6a1fa86..698507f 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -70,11 +70,11 @@ def forget(modname):
deleting any .pyc and .pyo files.'''
unload(modname)
for dirname in sys.path:
- unlink(os.path.join(dirname, modname + os.extsep + 'pyc'))
+ unlink(os.path.join(dirname, modname + '.pyc'))
# Deleting the .pyo file cannot be within the 'try' for the .pyc since
# the chance exists that there is no .pyc (and thus the 'try' statement
# is exited) but there is a .pyo file.
- unlink(os.path.join(dirname, modname + os.extsep + 'pyo'))
+ unlink(os.path.join(dirname, modname + '.pyo'))
def is_resource_enabled(resource):
"""Test whether a resource is enabled. Known resources are set by
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py
index 9ef6563..8ef9000 100644
--- a/Lib/test/test_tokenize.py
+++ b/Lib/test/test_tokenize.py
@@ -186,14 +186,14 @@ def test_main():
# This displays the tokenization of tokenize_tests.py to stdout, and
# regrtest.py checks that this equals the expected output (in the
# test/output/ directory).
- f = open(findfile('tokenize_tests' + os.extsep + 'txt'))
+ f = open(findfile('tokenize_tests.txt'))
tokenize(f.readline)
f.close()
# Now run test_roundtrip() over tokenize_test.py too, and over all
# (if the "compiler" resource is enabled) or a small random sample (if
# "compiler" is not enabled) of the test*.py files.
- f = findfile('tokenize_tests' + os.extsep + 'txt')
+ f = findfile('tokenize_tests.txt')
test_roundtrip(f)
testdir = os.path.dirname(f) or os.curdir
diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
index 98fe3c9..ef3987a 100644
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -29,7 +29,7 @@ class TestsWithSourceFile(unittest.TestCase):
def makeTestArchive(self, f, compression):
# Create the ZIP archive
zipfp = zipfile.ZipFile(f, "w", compression)
- zipfp.write(TESTFN, "another"+os.extsep+"name")
+ zipfp.write(TESTFN, "another.name")
zipfp.write(TESTFN, TESTFN)
zipfp.writestr("strfile", self.data)
zipfp.close()
@@ -40,7 +40,7 @@ class TestsWithSourceFile(unittest.TestCase):
# Read the ZIP archive
zipfp = zipfile.ZipFile(f, "r", compression)
self.assertEqual(zipfp.read(TESTFN), self.data)
- self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data)
+ self.assertEqual(zipfp.read("another.name"), self.data)
self.assertEqual(zipfp.read("strfile"), self.data)
# Print the ZIP directory
@@ -64,7 +64,7 @@ class TestsWithSourceFile(unittest.TestCase):
names = zipfp.namelist()
self.assertEquals(len(names), 3)
self.assert_(TESTFN in names)
- self.assert_("another"+os.extsep+"name" in names)
+ self.assert_("another.name" in names)
self.assert_("strfile" in names)
# Check infolist
@@ -72,13 +72,13 @@ class TestsWithSourceFile(unittest.TestCase):
names = [ i.filename for i in infos ]
self.assertEquals(len(names), 3)
self.assert_(TESTFN in names)
- self.assert_("another"+os.extsep+"name" in names)
+ self.assert_("another.name" in names)
self.assert_("strfile" in names)
for i in infos:
self.assertEquals(i.file_size, len(self.data))
# check getinfo
- for nm in (TESTFN, "another"+os.extsep+"name", "strfile"):
+ for nm in (TESTFN, "another.name", "strfile"):
info = zipfp.getinfo(nm)
self.assertEquals(info.filename, nm)
self.assertEquals(info.file_size, len(self.data))
@@ -105,7 +105,7 @@ class TestsWithSourceFile(unittest.TestCase):
zipdata1.append(read_data)
zipdata2 = []
- zipopen2 = zipfp.open("another"+os.extsep+"name")
+ zipopen2 = zipfp.open("another.name")
while 1:
read_data = zipopen2.read(256)
if not read_data:
@@ -313,13 +313,13 @@ class TestZip64InSmallFiles(unittest.TestCase):
def largeFileExceptionTest(self, f, compression):
zipfp = zipfile.ZipFile(f, "w", compression)
self.assertRaises(zipfile.LargeZipFile,
- zipfp.write, TESTFN, "another"+os.extsep+"name")
+ zipfp.write, TESTFN, "another.name")
zipfp.close()
def largeFileExceptionTest2(self, f, compression):
zipfp = zipfile.ZipFile(f, "w", compression)
self.assertRaises(zipfile.LargeZipFile,
- zipfp.writestr, "another"+os.extsep+"name", self.data)
+ zipfp.writestr, "another.name", self.data)
zipfp.close()
def testLargeFileException(self):
@@ -330,7 +330,7 @@ class TestZip64InSmallFiles(unittest.TestCase):
def zipTest(self, f, compression):
# Create the ZIP archive
zipfp = zipfile.ZipFile(f, "w", compression, allowZip64=True)
- zipfp.write(TESTFN, "another"+os.extsep+"name")
+ zipfp.write(TESTFN, "another.name")
zipfp.write(TESTFN, TESTFN)
zipfp.writestr("strfile", self.data)
zipfp.close()
@@ -338,7 +338,7 @@ class TestZip64InSmallFiles(unittest.TestCase):
# Read the ZIP archive
zipfp = zipfile.ZipFile(f, "r", compression)
self.assertEqual(zipfp.read(TESTFN), self.data)
- self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data)
+ self.assertEqual(zipfp.read("another.name"), self.data)
self.assertEqual(zipfp.read("strfile"), self.data)
# Print the ZIP directory
@@ -362,7 +362,7 @@ class TestZip64InSmallFiles(unittest.TestCase):
names = zipfp.namelist()
self.assertEquals(len(names), 3)
self.assert_(TESTFN in names)
- self.assert_("another"+os.extsep+"name" in names)
+ self.assert_("another.name" in names)
self.assert_("strfile" in names)
# Check infolist
@@ -370,13 +370,13 @@ class TestZip64InSmallFiles(unittest.TestCase):
names = [ i.filename for i in infos ]
self.assertEquals(len(names), 3)
self.assert_(TESTFN in names)
- self.assert_("another"+os.extsep+"name" in names)
+ self.assert_("another.name" in names)
self.assert_("strfile" in names)
for i in infos:
self.assertEquals(i.file_size, len(self.data))
# check getinfo
- for nm in (TESTFN, "another"+os.extsep+"name", "strfile"):
+ for nm in (TESTFN, "another.name", "strfile"):
info = zipfp.getinfo(nm)
self.assertEquals(info.filename, nm)
self.assertEquals(info.file_size, len(self.data))
@@ -675,7 +675,7 @@ class TestsWithRandomBinaryFiles(unittest.TestCase):
def makeTestArchive(self, f, compression):
# Create the ZIP archive
zipfp = zipfile.ZipFile(f, "w", compression)
- zipfp.write(TESTFN, "another"+os.extsep+"name")
+ zipfp.write(TESTFN, "another.name")
zipfp.write(TESTFN, TESTFN)
zipfp.close()
@@ -687,7 +687,7 @@ class TestsWithRandomBinaryFiles(unittest.TestCase):
testdata = zipfp.read(TESTFN)
self.assertEqual(len(testdata), len(self.data))
self.assertEqual(testdata, self.data)
- self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data)
+ self.assertEqual(zipfp.read("another.name"), self.data)
zipfp.close()
def testStored(self):
@@ -708,7 +708,7 @@ class TestsWithRandomBinaryFiles(unittest.TestCase):
zipdata1.append(read_data)
zipdata2 = []
- zipopen2 = zipfp.open("another"+os.extsep+"name")
+ zipopen2 = zipfp.open("another.name")
while 1:
read_data = zipopen2.read(256)
if not read_data:
diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py
index f36cbf4..17d5bb9 100644
--- a/Lib/test/test_zipimport.py
+++ b/Lib/test/test_zipimport.py
@@ -51,7 +51,7 @@ else:
TESTMOD = "ziptestmodule"
TESTPACK = "ziptestpackage"
TESTPACK2 = "ziptestpackage2"
-TEMP_ZIP = os.path.abspath("junk95142" + os.extsep + "zip")
+TEMP_ZIP = os.path.abspath("junk95142.zip")
class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
diff --git a/Lib/whichdb.py b/Lib/whichdb.py
index 752bbb1..ca9c736 100644
--- a/Lib/whichdb.py
+++ b/Lib/whichdb.py
@@ -30,18 +30,18 @@ def whichdb(filename):
# Check for dbm first -- this has a .pag and a .dir file
try:
- f = io.open(filename + os.extsep + "pag", "rb")
+ f = io.open(filename + ".pag", "rb")
f.close()
# dbm linked with gdbm on OS/2 doesn't have .dir file
if not (dbm.library == "GNU gdbm" and sys.platform == "os2emx"):
- f = io.open(filename + os.extsep + "dir", "rb")
+ f = io.open(filename + ".dir", "rb")
f.close()
return "dbm"
except IOError:
# some dbm emulations based on Berkeley DB generate a .db file
# some do not, but they should be caught by the dbhash checks
try:
- f = io.open(filename + os.extsep + "db", "rb")
+ f = io.open(filename + ".db", "rb")
f.close()
# guarantee we can actually open the file using dbm
# kind of overkill, but since we are dealing with emulations
@@ -56,12 +56,12 @@ def whichdb(filename):
# Check for dumbdbm next -- this has a .dir and a .dat file
try:
# First check for presence of files
- os.stat(filename + os.extsep + "dat")
- size = os.stat(filename + os.extsep + "dir").st_size
+ os.stat(filename + ".dat")
+ size = os.stat(filename + ".dir").st_size
# dumbdbm files with no keys are empty
if size == 0:
return "dumbdbm"
- f = io.open(filename + os.extsep + "dir", "rb")
+ f = io.open(filename + ".dir", "rb")
try:
if f.read(1) in (b"'", b'"'):
return "dumbdbm"