summaryrefslogtreecommitdiff
path: root/docutils
diff options
context:
space:
mode:
authorgrubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2008-11-30 09:46:40 +0000
committergrubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2008-11-30 09:46:40 +0000
commitc66abd1acccfb76dc9817a2372ba359a7eaba47f (patch)
tree476b3903bca219065d23329b0669b72220b1cfd4 /docutils
parent5d56fddcbcb6f944fbc9e79ba209090586ebb4c5 (diff)
downloaddocutils-c66abd1acccfb76dc9817a2372ba359a7eaba47f.tar.gz
Prepare for python 3.0: use os.walk instead os.path.walk.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5739 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r--docutils/HISTORY.txt1
-rwxr-xr-xdocutils/test/test_functional.py14
-rwxr-xr-xdocutils/tools/buildhtml.py5
3 files changed, 18 insertions, 2 deletions
diff --git a/docutils/HISTORY.txt b/docutils/HISTORY.txt
index da509812e..44eb0b4aa 100644
--- a/docutils/HISTORY.txt
+++ b/docutils/HISTORY.txt
@@ -19,6 +19,7 @@ Changes Since 0.5
* General:
+ - Prepare for python 3.0: use os.walk instead os.path.walk.
- Prepare for python 3.0: minimize "types" module where possible.
- Apply [ 1878977 ] make_id(): deaccent characters.
- Backwards-compatible changes to remove python2.6 -3 deprecation warnings
diff --git a/docutils/test/test_functional.py b/docutils/test/test_functional.py
index d2dff949d..91e1f5f40 100755
--- a/docutils/test/test_functional.py
+++ b/docutils/test/test_functional.py
@@ -39,7 +39,19 @@ class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite):
os.chdir(DocutilsTestSupport.testroot)
self.clear_output_directory()
self.added = 0
- os.path.walk(join_path(datadir, 'tests'), self.walker, None)
+ try:
+ for root, dirs, files in os.walk(join_path(datadir, 'tests')):
+ # Process all config files among `names` in `dirname`. A config
+ # file is a Python file (*.py) which sets several variables.
+ for name in files:
+ if name.endswith('.py') and not name.startswith('_'):
+ config_file_full_path = join_path(root, name)
+ self.addTestCase(FunctionalTestCase, 'test', None, None,
+ id=config_file_full_path,
+ configfile=config_file_full_path)
+ self.added += 1
+ except (AttributeError): # python2.2 does not have os.walk
+ os.path.walk(join_path(datadir, 'tests'), self.walker, None)
assert self.added, 'No functional tests found.'
def clear_output_directory(self):
diff --git a/docutils/tools/buildhtml.py b/docutils/tools/buildhtml.py
index e5fda8293..f85f25d34 100755
--- a/docutils/tools/buildhtml.py
+++ b/docutils/tools/buildhtml.py
@@ -181,7 +181,10 @@ class Builder:
else:
self.directories = [os.getcwd()]
for directory in self.directories:
- os.path.walk(directory, self.visit, recurse)
+ try:
+ os.path.walk(directory, self.visit, recurse)
+ except (AttributeError): # python2.2 does not have os.walk
+ os.path.walk(directory, self.visit, recurse)
def visit(self, recurse, directory, names):
settings = self.get_settings('', directory)