Skip to content

Commit 309a9d7

Browse files
DarkaMaulsigmavirus24
authored andcommitted
Add a backstop-test
Signed-off-by: Alexis <[email protected]>
1 parent 46bc5dd commit 309a9d7

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tests/test_check.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_fails_no_distributions(caplog):
4949
]
5050

5151

52-
def build_sdist(src_path, project_files):
52+
def build_package(src_path, project_files, distribution = "sdist"):
5353
"""
5454
Build a source distribution similar to `python3 -m build --sdist`.
5555
@@ -70,12 +70,13 @@ def build_sdist(src_path, project_files):
7070
(src_path / filename).write_text(textwrap.dedent(content))
7171

7272
builder = build.ProjectBuilder(src_path)
73-
return builder.build("sdist", str(src_path / "dist"))
73+
return builder.build(distribution, str(src_path / "dist"))
7474

7575

76+
@pytest.mark.parametrize("distribution", ["sdist", "wheel"])
7677
@pytest.mark.parametrize("strict", [False, True])
77-
def test_warns_missing_description(strict, tmp_path, capsys, caplog):
78-
sdist = build_sdist(
78+
def test_warns_missing_description(distribution, strict, tmp_path, capsys, caplog):
79+
sdist = build_package(
7980
tmp_path,
8081
{
8182
"setup.cfg": (
@@ -86,6 +87,7 @@ def test_warns_missing_description(strict, tmp_path, capsys, caplog):
8687
"""
8788
),
8889
},
90+
distribution=distribution,
8991
)
9092

9193
assert check.check([sdist], strict=strict) is strict
@@ -109,7 +111,7 @@ def test_warns_missing_description(strict, tmp_path, capsys, caplog):
109111

110112

111113
def test_warns_missing_file(tmp_path, capsys, caplog):
112-
sdist = build_sdist(
114+
sdist = build_package(
113115
tmp_path,
114116
{
115117
"setup.cfg": (
@@ -138,7 +140,7 @@ def test_warns_missing_file(tmp_path, capsys, caplog):
138140

139141

140142
def test_fails_rst_syntax_error(tmp_path, capsys, caplog):
141-
sdist = build_sdist(
143+
sdist = build_package(
142144
tmp_path,
143145
{
144146
"setup.cfg": (
@@ -174,7 +176,7 @@ def test_fails_rst_syntax_error(tmp_path, capsys, caplog):
174176

175177

176178
def test_fails_rst_no_content(tmp_path, capsys, caplog):
177-
sdist = build_sdist(
179+
sdist = build_package(
178180
tmp_path,
179181
{
180182
"setup.cfg": (
@@ -211,7 +213,7 @@ def test_fails_rst_no_content(tmp_path, capsys, caplog):
211213

212214

213215
def test_passes_rst_description(tmp_path, capsys, caplog):
214-
sdist = build_sdist(
216+
sdist = build_package(
215217
tmp_path,
216218
{
217219
"setup.cfg": (
@@ -243,7 +245,7 @@ def test_passes_rst_description(tmp_path, capsys, caplog):
243245

244246
@pytest.mark.parametrize("content_type", ["text/markdown", "text/plain"])
245247
def test_passes_markdown_description(content_type, tmp_path, capsys, caplog):
246-
sdist = build_sdist(
248+
sdist = build_package(
247249
tmp_path,
248250
{
249251
"setup.cfg": (

0 commit comments

Comments
 (0)