Skip to content

Commit

Permalink
Clear docutils.conf in SphinxTestApp.cleanup() (#11345)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
  • Loading branch information
marxin and AA-Turner committed Jul 20, 2023
1 parent ce140e8 commit 1b08535
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sphinx/testing/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ def __init__(
parallel: int = 0,
) -> None:

self.docutils_conf_path = srcdir / 'docutils.conf'
if docutilsconf is not None:
(srcdir / 'docutils.conf').write_text(docutilsconf)
self.docutils_conf_path.write_text(docutilsconf)

if builddir is None:
builddir = srcdir / '_build'
Expand Down Expand Up @@ -154,6 +155,10 @@ def cleanup(self, doctrees: bool = False) -> None:
method not in self._saved_nodeclasses:
delattr(nodes.GenericNodeVisitor, 'visit_' + method[6:])
delattr(nodes.GenericNodeVisitor, 'depart_' + method[6:])
try:
os.remove(self.docutils_conf_path)
except FileNotFoundError:
pass

def __repr__(self) -> str:
return f'<{self.__class__.__name__} buildername={self.builder.name!r}>'
Expand Down

0 comments on commit 1b08535

Please sign in to comment.