Skip to content

Conversation

@marxin
Copy link
Contributor

@marxin marxin commented Apr 12, 2023

The tests modify source files (index.rst), that is not restored and thus another test can reach a modified source file and it leads to unexpected test results.

Related: #11285

@AA-Turner

The tests modify source files (index.rst), that is not restored and thus
another test can reach a modified source file and it leads to unexpected
test results.

Related: sphinx-doc#11285
@marxin marxin force-pushed the tests-test_ext_autodoc_configs branch from 731a43f to 283abb2 Compare April 12, 2023 09:33
@marxin
Copy link
Contributor Author

marxin commented Apr 12, 2023

Looking at:

docutilsconf=('[restructuredtext parser]\n'
'trim_footnote_reference_space: true\n'))

there's a similar problem that docutils.conf is modified in srcdir:

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

and it's not restored later. Thus, we might want to use overwrite_file here. What do you think?

@AA-Turner
Copy link
Member

Perhaps if docutilsconf is set we could also clean it up in SphinxTestApp.cleanup()?

A

@AA-Turner AA-Turner changed the title restore overwritten source files in test_ext_autodoc_configs Use overwrite_file context manager in test_ext_autodoc_configs Apr 21, 2023
@AA-Turner AA-Turner merged commit 186d596 into sphinx-doc:master Apr 21, 2023
@AA-Turner
Copy link
Member

Thanks!

@marxin marxin deleted the tests-test_ext_autodoc_configs branch April 21, 2023 05:53
@marxin
Copy link
Contributor Author

marxin commented Apr 21, 2023

Perhaps if docutilsconf is set we could also clean it up in SphinxTestApp.cleanup()?

Sure, done in #11345.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants