diff options
author | yole <yole@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2002-08-11 19:41:37 +0000 |
---|---|---|
committer | yole <yole@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2002-08-11 19:41:37 +0000 |
commit | 73a19f891fbc2fcea2fd9a400f3fdebef3290cc7 (patch) | |
tree | dc505b0e53de2e76f9aedac1c0dfec13cd85f02c /docutils/test/package_unittest.py | |
parent | b4713ed9d26ef90ac6c9af16de1390445b3b87af (diff) | |
download | docutils-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.py | 12 |
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) |