blob: a7e77d5cf55f388ac01cf2d4b914040598cb67db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
from __future__ import annotations
import sys
from pathlib import Path
from textwrap import dedent
import pytest
from _pytest.tmpdir import TempPathFactory
@pytest.fixture(scope="session")
def pkg_with_extras_project(tmp_path_factory: TempPathFactory) -> Path:
py_ver = ".".join(str(i) for i in sys.version_info[0:2])
setup_cfg = f"""
[metadata]
name = demo
version = 1.0.0
[options]
packages = find:
install_requires =
platformdirs>=2.1
colorama>=0.4.3
[options.extras_require]
testing =
covdefaults>=1.2; python_version == '2.7' or python_version == '{py_ver}'
pytest>=5.4.1; python_version == '{py_ver}'
docs =
sphinx>=3
sphinx-rtd-theme>=0.4.3,<1
format =
black>=3
flake8
"""
tmp_path = tmp_path_factory.mktemp("prj")
(tmp_path / "setup.cfg").write_text(dedent(setup_cfg))
(tmp_path / "setup.py").write_text("from setuptools import setup; setup()")
toml = '[build-system]\nrequires=["setuptools", "wheel"]\nbuild-backend = "setuptools.build_meta"'
(tmp_path / "pyproject.toml").write_text(toml)
return tmp_path
|