style: apply black via pre-commit run -a
This commit is contained in:
committed by
Henry Schreiner
parent
9cbed6a9be
commit
178aaea6c7
@@ -5,7 +5,9 @@ from cibuildwheel.projectfiles import get_requires_python_str, setup_py_python_r
|
||||
|
||||
def test_read_setup_py_simple(tmp_path):
|
||||
with open(tmp_path / "setup.py", "w") as f:
|
||||
f.write(dedent("""
|
||||
f.write(
|
||||
dedent(
|
||||
"""
|
||||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
@@ -14,7 +16,9 @@ def test_read_setup_py_simple(tmp_path):
|
||||
example = ["item", "other"],
|
||||
python_requires = "1.23",
|
||||
)
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assert setup_py_python_requires(tmp_path.joinpath("setup.py").read_text()) == "1.23"
|
||||
assert get_requires_python_str(tmp_path) == "1.23"
|
||||
@@ -22,7 +26,9 @@ def test_read_setup_py_simple(tmp_path):
|
||||
|
||||
def test_read_setup_py_full(tmp_path):
|
||||
with open(tmp_path / "setup.py", "w") as f:
|
||||
f.write(dedent("""
|
||||
f.write(
|
||||
dedent(
|
||||
"""
|
||||
import setuptools
|
||||
|
||||
setuptools.randomfunc()
|
||||
@@ -33,7 +39,9 @@ def test_read_setup_py_full(tmp_path):
|
||||
example = ["item", "other"],
|
||||
python_requires = "1.24",
|
||||
)
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assert setup_py_python_requires(tmp_path.joinpath("setup.py").read_text()) == "1.24"
|
||||
assert get_requires_python_str(tmp_path) == "1.24"
|
||||
@@ -41,7 +49,9 @@ def test_read_setup_py_full(tmp_path):
|
||||
|
||||
def test_read_setup_py_assign(tmp_path):
|
||||
with open(tmp_path / "setup.py", "w") as f:
|
||||
f.write(dedent("""
|
||||
f.write(
|
||||
dedent(
|
||||
"""
|
||||
from setuptools import setup
|
||||
|
||||
REQUIRES = "3.21"
|
||||
@@ -52,7 +62,9 @@ def test_read_setup_py_assign(tmp_path):
|
||||
example = ["item", "other"],
|
||||
python_requires = REQUIRES,
|
||||
)
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assert setup_py_python_requires(tmp_path.joinpath("setup.py").read_text()) is None
|
||||
assert get_requires_python_str(tmp_path) is None
|
||||
@@ -60,7 +72,9 @@ def test_read_setup_py_assign(tmp_path):
|
||||
|
||||
def test_read_setup_py_None(tmp_path):
|
||||
with open(tmp_path / "setup.py", "w") as f:
|
||||
f.write(dedent("""
|
||||
f.write(
|
||||
dedent(
|
||||
"""
|
||||
from setuptools import setup
|
||||
|
||||
REQUIRES = None
|
||||
@@ -71,7 +85,9 @@ def test_read_setup_py_None(tmp_path):
|
||||
example = ["item", "other"],
|
||||
python_requires = None,
|
||||
)
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assert setup_py_python_requires(tmp_path.joinpath("setup.py").read_text()) is None
|
||||
assert get_requires_python_str(tmp_path) is None
|
||||
@@ -79,7 +95,9 @@ def test_read_setup_py_None(tmp_path):
|
||||
|
||||
def test_read_setup_py_empty(tmp_path):
|
||||
with open(tmp_path / "setup.py", "w") as f:
|
||||
f.write(dedent("""
|
||||
f.write(
|
||||
dedent(
|
||||
"""
|
||||
from setuptools import setup
|
||||
|
||||
REQUIRES = "3.21"
|
||||
@@ -89,7 +107,9 @@ def test_read_setup_py_empty(tmp_path):
|
||||
other = 23,
|
||||
example = ["item", "other"],
|
||||
)
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assert setup_py_python_requires(tmp_path.joinpath("setup.py").read_text()) is None
|
||||
assert get_requires_python_str(tmp_path) is None
|
||||
@@ -97,46 +117,62 @@ def test_read_setup_py_empty(tmp_path):
|
||||
|
||||
def test_read_setup_cfg(tmp_path):
|
||||
with open(tmp_path / "setup.cfg", "w") as f:
|
||||
f.write(dedent("""
|
||||
f.write(
|
||||
dedent(
|
||||
"""
|
||||
[options]
|
||||
python_requires = 1.234
|
||||
[metadata]
|
||||
something = other
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assert get_requires_python_str(tmp_path) == "1.234"
|
||||
|
||||
|
||||
def test_read_setup_cfg_empty(tmp_path):
|
||||
with open(tmp_path / "setup.cfg", "w") as f:
|
||||
f.write(dedent("""
|
||||
f.write(
|
||||
dedent(
|
||||
"""
|
||||
[options]
|
||||
other = 1.234
|
||||
[metadata]
|
||||
something = other
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assert get_requires_python_str(tmp_path) is None
|
||||
|
||||
|
||||
def test_read_pyproject_toml(tmp_path):
|
||||
with open(tmp_path / "pyproject.toml", "w") as f:
|
||||
f.write(dedent("""
|
||||
f.write(
|
||||
dedent(
|
||||
"""
|
||||
[project]
|
||||
requires-python = "1.654"
|
||||
|
||||
[tool.cibuildwheel]
|
||||
something = "other"
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assert get_requires_python_str(tmp_path) == "1.654"
|
||||
|
||||
|
||||
def test_read_pyproject_toml_empty(tmp_path):
|
||||
with open(tmp_path / "pyproject.toml", "w") as f:
|
||||
f.write(dedent("""
|
||||
f.write(
|
||||
dedent(
|
||||
"""
|
||||
[project]
|
||||
other = 1.234
|
||||
"""))
|
||||
"""
|
||||
)
|
||||
)
|
||||
|
||||
assert get_requires_python_str(tmp_path) is None
|
||||
|
||||
Reference in New Issue
Block a user