Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1f09111

Browse filesBrowse files
committed
build(conftest): Move to root level
Required by pytest_plugins to be at the top level, makes py.test README.md possible to run, as well as keeping conftest.py excluded from wheel package.
1 parent 3778bf2 commit 1f09111
Copy full SHA for 1f09111

File tree

Expand file treeCollapse file tree

5 files changed

+42
-36
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+42
-36
lines changed

‎conftest.py

Copy file name to clipboard
+41Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""Conftest.py (root-level)
2+
3+
We keep this in root pytest fixtures in pytest's doctest plugin to be available, as well
4+
as avoiding conftest.py from being included in the wheel, in addition to pytest_plugin
5+
for pytester only being available via the root directory.
6+
7+
See "pytest_plugins in non-top-level conftest files" in
8+
https://docs.pytest.org/en/stable/deprecations.html
9+
"""
10+
import pathlib
11+
import typing as t
12+
13+
import pytest
14+
15+
pytest_plugins = ["pytester"]
16+
17+
18+
@pytest.fixture(autouse=True)
19+
def add_doctest_fixtures(
20+
request: pytest.FixtureRequest,
21+
doctest_namespace: t.Dict[str, t.Any],
22+
) -> None:
23+
from _pytest.doctest import DoctestItem
24+
25+
if isinstance(request._pyfuncitem, DoctestItem):
26+
request.getfixturevalue("add_doctest_fixtures")
27+
request.getfixturevalue("set_home")
28+
29+
30+
@pytest.fixture(autouse=True)
31+
def setup(
32+
request: pytest.FixtureRequest,
33+
gitconfig: pathlib.Path,
34+
set_home: pathlib.Path,
35+
) -> None:
36+
pass
37+
38+
39+
@pytest.fixture(autouse=True)
40+
def cwd_default(monkeypatch: pytest.MonkeyPatch, tmp_path: pathlib.Path) -> None:
41+
monkeypatch.chdir(tmp_path)

‎pyproject.toml

Copy file name to clipboardExpand all lines: pyproject.toml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ packages = [
5050
]
5151
include = [
5252
{ path = "tests", format = "sdist" },
53+
{ path = "conftest.py", format = "sdist" },
5354
]
5455

5556
[tool.poetry.urls]

‎src/libvcs/conftest.py

Copy file name to clipboardExpand all lines: src/libvcs/conftest.py
-25Lines changed: 0 additions & 25 deletions
This file was deleted.

‎tests/_internal/subprocess/conftest.py

Copy file name to clipboardExpand all lines: tests/_internal/subprocess/conftest.py
-8Lines changed: 0 additions & 8 deletions
This file was deleted.

‎tests/conftest.py

Copy file name to clipboardExpand all lines: tests/conftest.py
-3Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.