Explicitly remove the `autodoc_fodder` module

This commit is contained in:
Adam Turner 2024-01-18 23:55:43 +00:00
parent f195c4ae87
commit 6fab64fb55
5 changed files with 11 additions and 1 deletions

View File

@ -177,4 +177,3 @@ def _clean_up_global_state() -> None:
# clean up autodoc global state
sphinx.pycode.ModuleAnalyzer.cache.clear()
sys.modules.pop('autodoc_fodder', None)

View File

@ -3,6 +3,7 @@
import os
import posixpath
import re
import sys
import pytest
@ -80,6 +81,7 @@ def test_html_warnings(app, warning):
+ f'--- Expected (regex):\n{warnings_exp}\n'
+ f'--- Got:\n{warnings}'
)
sys.modules.pop('autodoc_fodder', None)
def test_html4_error(make_app, tmp_path):

View File

@ -3,6 +3,7 @@
import os
import re
import subprocess
import sys
from itertools import chain, product
from pathlib import Path
from shutil import copyfile
@ -183,6 +184,7 @@ def test_latex_warnings(app, status, warning):
+ f'--- Expected (regex):\n{warnings_exp}\n'
+ f'--- Got:\n{warnings}'
)
sys.modules.pop('autodoc_fodder', None)
@pytest.mark.sphinx('latex', testroot='basic')

View File

@ -3,6 +3,7 @@
import os
import re
import subprocess
import sys
from pathlib import Path
from subprocess import CalledProcessError
from unittest.mock import Mock
@ -36,6 +37,7 @@ def test_texinfo_warnings(app, status, warning):
+ f'--- Expected (regex):\n{warnings_exp}\n'
+ f'--- Got:\n{warnings}'
)
sys.modules.pop('autodoc_fodder', None)
@pytest.mark.sphinx('texinfo')

View File

@ -1,4 +1,7 @@
"""Test the Builder class."""
import sys
import pytest
@ -37,3 +40,5 @@ def test_incremental_reading_for_missing_files(app):
# "index" is listed up to updated because it contains references
# to nonexisting downloadable or image files
assert set(updated) == {'index'}
sys.modules.pop('autodoc_fodder', None)