diff options
Diffstat (limited to 'tests/testasciidoc.py')
-rwxr-xr-x | tests/testasciidoc.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/testasciidoc.py b/tests/testasciidoc.py index 4d2605a..c3426c4 100755 --- a/tests/testasciidoc.py +++ b/tests/testasciidoc.py @@ -77,6 +77,7 @@ class AsciiDocTest(object): self.options = [] self.attributes = {'asciidoc-version': 'test'} self.backends = BACKENDS + self.artifacts = [] # list of generated artifacts to delete self.requires = [] # list of dependencies to check for for the test self.confdir = None self.datadir = None # Where output files are stored. @@ -134,6 +135,8 @@ class AsciiDocTest(object): self.name = data[0].strip() elif directive == 'requires': self.requires = eval(' '.join(data)) + elif directive == 'artifacts': + self.artifacts = eval(' '.join(data)) else: raise ValueError if not self.title: @@ -155,6 +158,12 @@ class AsciiDocTest(object): os.path.getmtime(self.source) > os.path.getmtime(self.backend_filename(backend))) + def clean_artifacts(self): + for artifact in self.artifacts: + loc = os.path.join(self.confdir, artifact) + if os.path.exists(loc): + os.unlink(loc) + def get_expected(self, backend): """ Return expected test data output for backend. @@ -200,6 +209,7 @@ class AsciiDocTest(object): for backend in backends: if force or self.is_missing_or_outdated(backend): self.update_expected(backend) + self.clean_artifacts() def run(self, backend=None): """ @@ -246,6 +256,7 @@ class AsciiDocTest(object): else: self.skipped += 1 print(('SKIPPED: %s: %s' % (backend, fromfile))) + self.clean_artifacts() else: self.skipped += len(backends) if self.source: |