Skip to content

Commit

Permalink
Always define, add underscores, always remove
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jul 20, 2023
1 parent dd95be4 commit 7a18794
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sphinx/testing/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,9 @@ def __init__(
parallel: int = 0,
) -> None:

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

if builddir is None:
builddir = srcdir / '_build'
Expand Down Expand Up @@ -157,8 +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:])
if self.docutilsconfpath:
self.docutilsconfpath.unlink()
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 7a18794

Please sign in to comment.