diff options
| author | georg.brandl <devnull@localhost> | 2008-08-04 22:20:44 +0000 |
|---|---|---|
| committer | georg.brandl <devnull@localhost> | 2008-08-04 22:20:44 +0000 |
| commit | 335c6d83d4469b1448b4c6a6b6d97e463fe84c7c (patch) | |
| tree | 5566bea9e849e88da9e404468e6e6d189688e04b /tests | |
| parent | 6181d4383e76b1edef79e3c3fc80a5bb8368bb63 (diff) | |
| download | sphinx-335c6d83d4469b1448b4c6a6b6d97e463fe84c7c.tar.gz | |
Merged revisions 65529 via svnmerge from
svn+ssh://pythondev@svn.python.org/doctools/branches/0.4.x
........
r65529 | georg.brandl | 2008-08-04 22:19:30 +0000 (Mon, 04 Aug 2008) | 6 lines
Revert r65499 which was not well thought out. Instead, put
the whole build dir in exclude_trees by default in quickstart.
Also, revisit application cleanup and make it consistently use
less setup time while still trying to leave to traces.
........
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/root/conf.py | 1 | ||||
| -rw-r--r-- | tests/test_build.py | 2 | ||||
| -rw-r--r-- | tests/test_markup.py | 2 | ||||
| -rw-r--r-- | tests/util.py | 29 |
4 files changed, 16 insertions, 18 deletions
diff --git a/tests/root/conf.py b/tests/root/conf.py index 5bd659ef..fd04933b 100644 --- a/tests/root/conf.py +++ b/tests/root/conf.py @@ -57,7 +57,6 @@ today_fmt = '%B %d, %Y' # List of directories, relative to source directories, that shouldn't be searched # for source files. -#exclude_dirs = [] exclude_trees = ['_build'] # If true, '()' will be appended to :func: etc. cross-reference text. diff --git a/tests/test_build.py b/tests/test_build.py index 9046bc89..5ce48273 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -112,6 +112,6 @@ def test_linkcheck(app): def test_text(app): app.builder.build_all() -@with_testapp(buildername='changes') +@with_testapp(buildername='changes', cleanenv=True) def test_changes(app): app.builder.build_all() diff --git a/tests/test_markup.py b/tests/test_markup.py index 23330a60..3a3cb9d7 100644 --- a/tests/test_markup.py +++ b/tests/test_markup.py @@ -22,7 +22,7 @@ from sphinx.latexwriter import LaTeXWriter, LaTeXTranslator def setup_module(): global app, settings, parser - app = TestApp() + app = TestApp(cleanenv=True) optparser = frontend.OptionParser(components=(rst.Parser, HTMLWriter, LaTeXWriter)) settings = optparser.get_default_values() settings.env = app.builder.env diff --git a/tests/util.py b/tests/util.py index ba53c43c..f2eb3fd5 100644 --- a/tests/util.py +++ b/tests/util.py @@ -94,32 +94,34 @@ class TestApp(application.Sphinx): def __init__(self, srcdir=None, confdir=None, outdir=None, doctreedir=None, buildername='html', confoverrides=None, status=None, warning=None, - freshenv=None, confname='conf.py'): + freshenv=None, confname='conf.py', cleanenv=False): application.CONFIG_FILENAME = confname + self.cleanup_trees = [] + if srcdir is None: srcdir = test_root if srcdir == '(temp)': - tempdir = path(tempfile.mkdtemp()) / 'root' - test_root.copytree(tempdir) - srcdir = tempdir + tempdir = path(tempfile.mkdtemp()) + self.cleanup_trees.append(tempdir) + temproot = tempdir / 'root' + test_root.copytree(temproot) + srcdir = temproot else: srcdir = path(srcdir) self.builddir = srcdir.joinpath('_build') - if not self.builddir.isdir(): - self.builddir.makedirs() - self.made_builddir = True - else: - self.made_builddir = False if confdir is None: confdir = srcdir if outdir is None: outdir = srcdir.joinpath(self.builddir, buildername) if not outdir.isdir(): outdir.makedirs() + self.cleanup_trees.insert(0, outdir) if doctreedir is None: doctreedir = srcdir.joinpath(srcdir, self.builddir, 'doctrees') + if cleanenv: + self.cleanup_trees.insert(0, doctreedir) if confoverrides is None: confoverrides = {} if status is None: @@ -127,17 +129,14 @@ class TestApp(application.Sphinx): if warning is None: warning = ListOutput('stderr') if freshenv is None: - freshenv = True + freshenv = False application.Sphinx.__init__(self, srcdir, confdir, outdir, doctreedir, buildername, confoverrides, status, warning, freshenv) - def cleanup(self): - trees = [self.outdir, self.doctreedir] - if self.made_builddir: - trees.append(self.builddir) - for tree in trees: + def cleanup(self, doctrees=False): + for tree in self.cleanup_trees: shutil.rmtree(tree, True) |
