mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Move `make_app_with_empty_project() to conftest.py`
This commit is contained in:
@@ -89,3 +89,14 @@ def _http_teapot(monkeypatch: pytest.MonkeyPatch) -> Iterator[None]:
|
|||||||
with monkeypatch.context() as m:
|
with monkeypatch.context() as m:
|
||||||
m.setattr('sphinx.util.requests._Session.request', _request)
|
m.setattr('sphinx.util.requests._Session.request', _request)
|
||||||
yield
|
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
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import pickle
|
import pickle
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from pathlib import Path
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
from unittest import mock
|
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)
|
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')
|
@mock.patch.object(sphinx, '__display_version__', '1.6.4')
|
||||||
def test_needs_sphinx(make_app_with_empty_project):
|
def test_needs_sphinx(make_app_with_empty_project):
|
||||||
make_app = make_app_with_empty_project
|
make_app = make_app_with_empty_project
|
||||||
|
|||||||
Reference in New Issue
Block a user