Move `make_app_with_empty_project() to conftest.py`

This commit is contained in:
Adam Turner 2025-02-11 00:53:44 +00:00
parent a9534901a2
commit ebec42c02b
2 changed files with 11 additions and 12 deletions

View File

@ -89,3 +89,14 @@ def _http_teapot(monkeypatch: pytest.MonkeyPatch) -> Iterator[None]:
with monkeypatch.context() as m:
m.setattr('sphinx.util.requests._Session.request', _request)
yield
@pytest.fixture
def make_app_with_empty_project(make_app, tmp_path):
(tmp_path / 'conf.py').touch()
def _make_app(*args, **kw):
kw.setdefault('srcdir', Path(tmp_path))
return make_app(*args, **kw)
return _make_app

View File

@ -4,7 +4,6 @@ from __future__ import annotations
import pickle
from collections import Counter
from pathlib import Path
from typing import TYPE_CHECKING, Any
from unittest import mock
@ -411,17 +410,6 @@ def test_errors_if_setup_is_not_callable(tmp_path, make_app):
assert 'callable' in str(excinfo.value)
@pytest.fixture
def make_app_with_empty_project(make_app, tmp_path):
(tmp_path / 'conf.py').touch()
def _make_app(*args, **kw):
kw.setdefault('srcdir', Path(tmp_path))
return make_app(*args, **kw)
return _make_app
@mock.patch.object(sphinx, '__display_version__', '1.6.4')
def test_needs_sphinx(make_app_with_empty_project):
make_app = make_app_with_empty_project