summaryrefslogtreecommitdiff
path: root/docutils/test/package_unittest.py
diff options
context:
space:
mode:
authoryole <yole@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2002-08-11 19:41:37 +0000
committeryole <yole@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2002-08-11 19:41:37 +0000
commit73a19f891fbc2fcea2fd9a400f3fdebef3290cc7 (patch)
treedc505b0e53de2e76f9aedac1c0dfec13cd85f02c /docutils/test/package_unittest.py
parentb4713ed9d26ef90ac6c9af16de1390445b3b87af (diff)
downloaddocutils-73a19f891fbc2fcea2fd9a400f3fdebef3290cc7.tar.gz
Second version of the .. sectnum:: directive implementation. Also, the
really working fix of the empty path problem in package_unittest.py. git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@500 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test/package_unittest.py')
-rw-r--r--docutils/test/package_unittest.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/docutils/test/package_unittest.py b/docutils/test/package_unittest.py
index 8dfeb8cf5..340e3dad6 100644
--- a/docutils/test/package_unittest.py
+++ b/docutils/test/package_unittest.py
@@ -84,13 +84,21 @@ def loadTestModules(path, name='', packages=None):
while paths:
p = paths.pop(0)
if not p:
- p = os.getcwd()
+ p = os.curdir
files = os.listdir(p)
for filename in files:
if filename.startswith(name):
fullpath = os.path.join(p, filename)
if filename.endswith('.py'):
- testModules.append(path2mod(fullpath[len(path)+1:]))
+ # If the path is empty, we get a module name
+ # starting with ./ . It means that we need to truncate
+ # two characters from the start in order to get a
+ # meaningful module name.
+ if fullpath[0:2] == '.' + os.sep:
+ fullpath = fullpath[2:]
+ else:
+ fullpath = fullpath[len(path)+1:]
+ testModules.append(path2mod(fullpath))
elif packages and os.path.isdir(fullpath) and \
os.path.isfile(os.path.join(fullpath, '__init__.py')):
paths.append(fullpath)