diff options
| author | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2004-08-31 15:27:47 +0000 |
|---|---|---|
| committer | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2004-08-31 15:27:47 +0000 |
| commit | 36f9ba70826be2f0223ad8b9ec37fa8788a7569f (patch) | |
| tree | 62d2062f7a85031795fd9ef704f3fa8cf0dc92f4 /docutils/test/test_functional.py | |
| parent | 14c1d5ebc80409b7707a7a6698f78b4bbd0707f1 (diff) | |
| download | docutils-36f9ba70826be2f0223ad8b9ec37fa8788a7569f.tar.gz | |
trying to fix the slash/backslash bug occuring on Windows systems
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@2550 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/test/test_functional.py')
| -rwxr-xr-x | docutils/test/test_functional.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/docutils/test/test_functional.py b/docutils/test/test_functional.py index c8413be73..091532dc4 100755 --- a/docutils/test/test_functional.py +++ b/docutils/test/test_functional.py @@ -23,12 +23,16 @@ import DocutilsTestSupport # Ugly magic to determine the test directory. -testroot = os.path.dirname(DocutilsTestSupport.__file__) +testroot = os.path.dirname(DocutilsTestSupport.__file__) or '.' datadir = 'functional' """The directory to store the data needed for the functional tests.""" +def join_path(*args): + return '/'.join(args) or '.' + + class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): """Test suite containing test cases for all config files.""" @@ -38,7 +42,7 @@ class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): DocutilsTestSupport.CustomTestSuite.__init__(self) os.chdir(testroot) self.added = 0 - os.path.walk(os.path.join(datadir, 'tests'), self.walker, None) + os.path.walk(join_path(datadir, 'tests'), self.walker, None) assert self.added, 'No functional tests found.' def walker(self, dummy, dirname, names): @@ -50,7 +54,7 @@ class FunctionalTestSuite(DocutilsTestSupport.CustomTestSuite): """ for name in names: if name.endswith('.py') and not name.startswith('_'): - config_file_full_path = os.path.join(dirname, name) + config_file_full_path = join_path(dirname, name) self.addTestCase(FunctionalTestCase, 'test', None, None, id=config_file_full_path, configfile=config_file_full_path) @@ -80,7 +84,7 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): params['settings_overrides'] = {'_disable_config': 1} # Read the variables set in the default config file and in # the current config file into params: - execfile(os.path.join(datadir, 'tests', '_default.py'), params) + execfile(join_path(datadir, 'tests', '_default.py'), params) execfile(self.configfile, params) # Check for required settings: assert params.has_key('test_source'),\ @@ -89,14 +93,14 @@ class FunctionalTestCase(DocutilsTestSupport.CustomTestCase): "No 'test_destination' supplied in " + self.configfile # Set source_path and destination_path if not given: params.setdefault('source_path', - os.path.join(datadir, 'input', + join_path(datadir, 'input', params['test_source'])) # Path for actual output: params.setdefault('destination_path', - os.path.join(datadir, 'output', + join_path(datadir, 'output', params['test_destination'])) # Path for expected output: - expected_path = os.path.join(datadir, 'expected', + expected_path = join_path(datadir, 'expected', params['test_destination']) # test_source and test_destination aren't needed any more: del params['test_source'] |
