Commits

Georg Brandl committed 4b4bd9d

Fix a bug in FilenameUniqDict that led to test failures.

Comments (0)

Files changed (3)

sphinx/util/__init__.py

     def add_file(self, docname, newfile):
         if newfile in self:
             self[newfile][0].add(docname)
-            return
+            return self[newfile][1]
         uniquename = path.basename(newfile)
         base, ext = path.splitext(uniquename)
         i = 0
     def purge_doc(self, docname):
         for filename, (docs, _) in self.items():
             docs.discard(docname)
-            if not docs:
-                del self[filename]
+            #if not docs:
+            #    del self[filename]
+            #    self._existing.discard(filename)
 
     def __getstate__(self):
         return self._existing

tests/test_build.py

 from sphinx.writers.latex import LaTeXTranslator
 
 
+def teardown_module():
+    (test_root / '_build').rmtree()
+
+
 html_warnfile = StringIO()
 latex_warnfile = StringIO()
 
         @wraps(func)
         def deco(*args2, **kwargs2):
             app = TestApp(*args, **kwargs)
-            try:
-                return func(app, *args2, **kwargs2)
-            finally:
-                app.cleanup()
+            func(app, *args2, **kwargs2)
+            # don't execute cleanup if test failed
+            app.cleanup()
         return deco
     return generator
 
         @wraps(func)
         def deco(*args2, **kwargs2):
             app = TestApp(*args, **kwargs)
-            try:
-                for item in func(app, *args2, **kwargs2):
-                    yield item
-            finally:
-                app.cleanup()
+            for item in func(app, *args2, **kwargs2):
+                yield item
+            # don't execute cleanup if test failed
+            app.cleanup()
         return deco
     return generator