Skip to content

Commit 6919ce9

Browse files
authored
Remove pytest markers (#101)
* Remove pytest markers * Drop marker coverage flags * Add justfile
1 parent e8a23d5 commit 6919ce9

10 files changed

Lines changed: 26 additions & 62 deletions

File tree

.github/workflows/main.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,11 @@ jobs:
4848
enable-cache: true
4949
python-version: ${{ matrix.python-version }}
5050

51-
# Unit, integration, and end-to-end tests.
52-
53-
- name: Run unit tests and doctests.
54-
shell: bash -l {0}
55-
run: uv run --extra test pytest -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto
56-
57-
- name: Upload coverage report for unit tests and doctests.
58-
if: runner.os == 'Linux' && matrix.python-version == '3.10'
59-
shell: bash -l {0}
60-
run: bash <(curl -s https://codecov.io/bash) -F unit -c
61-
62-
- name: Run end-to-end tests.
51+
- name: Run tests
6352
shell: bash -l {0}
64-
run: uv run --extra test pytest -m end_to_end --cov=./ --cov-report=xml -n auto
53+
run: uv run --extra test pytest --cov=./ --cov-report=xml -n auto
6554

66-
- name: Upload coverage reports of end-to-end tests.
55+
- name: Upload coverage report
6756
if: runner.os == 'Linux' && matrix.python-version == '3.10'
6857
shell: bash -l {0}
69-
run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c
58+
run: bash <(curl -s https://codecov.io/bash) -c

codecov.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,6 @@ coverage:
66
project:
77
default:
88
threshold: 1%
9-
unit:
10-
threshold: 1%
11-
flags:
12-
- unit
13-
integration:
14-
threshold: 1%
15-
flags:
16-
- integration
17-
end_to_end:
18-
threshold: 1%
19-
flags:
20-
- end_to_end
219

2210
ignore:
2311
- ".tox/**/*"

justfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Install all dependencies
2+
install:
3+
uv sync --all-groups
4+
5+
# Run tests
6+
test *FLAGS:
7+
uv run --group test pytest {{FLAGS}}
8+
9+
# Run tests with coverage
10+
test-cov *FLAGS:
11+
uv run --group test pytest --cov=./ --cov-report=xml -n auto {{FLAGS}}
12+
13+
# Run type checking
14+
typing:
15+
uv run --group typing --group test ty check src/ tests/
16+
17+
# Run linting
18+
lint:
19+
uvx prek run -a
20+
21+
# Run all checks (format, lint, typing, test)
22+
check: lint typing test

pyproject.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,4 @@ unused-ignore-comment = "ignore"
9999

100100
[tool.pytest.ini_options]
101101
testpaths = ["src", "tests"]
102-
markers = [
103-
"wip: Tests that are work-in-progress.",
104-
"unit: Flag for unit tests which target mainly a single function.",
105-
"integration: Flag for integration tests which may comprise of multiple unit tests.",
106-
"end_to_end: Flag for tests that cover the whole program.",
107-
]
108102
norecursedirs = [".idea", ".tox"]

tests/test_collect.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from pytask_latex.collect import latex
88

99

10-
@pytest.mark.unit
1110
@pytest.mark.parametrize(
1211
("kwargs", "expectation", "expected"),
1312
[

tests/test_config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
from __future__ import annotations
22

3-
import pytest
43
from pytask import build
54

65

7-
@pytest.mark.end_to_end
86
def test_marker_is_configured(tmp_path):
97
session = build(paths=tmp_path)
108
assert "latex" in session.config["markers"]

tests/test_execute.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from tests.conftest import skip_on_github_actions_with_win
1919

2020

21-
@pytest.mark.unit
2221
def test_pytask_execute_task_setup(monkeypatch):
2322
"""Make sure that the task setup raises errors."""
2423
# Act like latexmk is installed since we do not test this.
@@ -38,7 +37,6 @@ def test_pytask_execute_task_setup(monkeypatch):
3837

3938
@needs_latexmk
4039
@skip_on_github_actions_with_win
41-
@pytest.mark.end_to_end
4240
def test_compile_latex_document(runner, tmp_path):
4341
"""Test simple compilation."""
4442
task_source = """
@@ -64,7 +62,6 @@ def task_compile_document():
6462

6563
@needs_latexmk
6664
@skip_on_github_actions_with_win
67-
@pytest.mark.end_to_end
6865
def test_compile_latex_document_w_relative(runner, tmp_path):
6966
"""Test simple compilation."""
7067
task_source = f"""
@@ -96,7 +93,6 @@ def task_compile_document():
9693

9794
@needs_latexmk
9895
@skip_on_github_actions_with_win
99-
@pytest.mark.end_to_end
10096
def test_compile_latex_document_to_different_name(runner, tmp_path):
10197
"""Compile a LaTeX document where source and output name differ."""
10298
task_source = """
@@ -123,7 +119,6 @@ def task_compile_document():
123119

124120
@needs_latexmk
125121
@skip_on_github_actions_with_win
126-
@pytest.mark.end_to_end
127122
def test_compile_w_bibliography(runner, tmp_path):
128123
"""Compile a LaTeX document with bibliography."""
129124
task_source = """
@@ -162,7 +157,6 @@ def task_compile_document():
162157

163158

164159
@skip_on_github_actions_with_win
165-
@pytest.mark.end_to_end
166160
def test_raise_error_if_latexmk_is_not_found(tmp_path, monkeypatch):
167161
task_source = """
168162
from pytask import mark
@@ -197,7 +191,6 @@ def task_compile_document():
197191

198192

199193
@skip_on_github_actions_with_win
200-
@pytest.mark.end_to_end
201194
def test_skip_even_if_latexmk_is_not_found(tmp_path, monkeypatch):
202195
task_source = """
203196
from pytask import mark
@@ -234,7 +227,6 @@ def task_compile_document():
234227

235228
@needs_latexmk
236229
@skip_on_github_actions_with_win
237-
@pytest.mark.end_to_end
238230
def test_compile_latex_document_w_xelatex(runner, tmp_path):
239231
task_source = """
240232
from pytask import mark
@@ -269,7 +261,6 @@ def task_compile_document():
269261

270262
@needs_latexmk
271263
@skip_on_github_actions_with_win
272-
@pytest.mark.end_to_end
273264
def test_compile_latex_document_w_two_dependencies(runner, tmp_path):
274265
task_source = """
275266
from pytask import mark
@@ -297,7 +288,6 @@ def task_compile_document(path: Path = Path("in.txt")):
297288

298289
@needs_latexmk
299290
@skip_on_github_actions_with_win
300-
@pytest.mark.end_to_end
301291
def test_fail_because_script_is_not_latex(tmp_path):
302292
task_source = """
303293
from pytask import mark
@@ -327,7 +317,6 @@ def task_compile_document(path: Path = Path("in.txt")):
327317

328318
@needs_latexmk
329319
@skip_on_github_actions_with_win
330-
@pytest.mark.end_to_end
331320
def test_compile_document_to_out_if_document_has_relative_resources(tmp_path):
332321
"""Test that motivates the ``"--cd"`` flag.
333322
@@ -370,7 +359,6 @@ def task_compile_document(path: Path = Path("resources/content.tex")):
370359

371360
@needs_latexmk
372361
@skip_on_github_actions_with_win
373-
@pytest.mark.end_to_end
374362
def test_compile_document_w_wrong_flag(tmp_path):
375363
"""Test that wrong flags raise errors."""
376364
tmp_path.joinpath("sub").mkdir(parents=True)
@@ -407,7 +395,6 @@ def task_compile_document():
407395

408396

409397
@needs_latexmk
410-
@pytest.mark.end_to_end
411398
def test_compile_document_w_image(runner, tmp_path):
412399
task_source = f"""
413400
from pytask import Product
@@ -443,7 +430,6 @@ def task_compile_document():
443430

444431
@needs_latexmk
445432
@skip_on_github_actions_with_win
446-
@pytest.mark.end_to_end
447433
def test_compile_latex_document_w_multiple_marks(runner, tmp_path):
448434
"""Test simple compilation."""
449435
task_source = """
@@ -471,7 +457,6 @@ def task_compile_document():
471457

472458
@needs_latexmk
473459
@skip_on_github_actions_with_win
474-
@pytest.mark.end_to_end
475460
def test_compile_latex_document_with_wrong_extension(runner, tmp_path):
476461
"""Test simple compilation."""
477462
task_source = """
@@ -498,7 +483,6 @@ def task_compile_document():
498483

499484
@needs_latexmk
500485
@skip_on_github_actions_with_win
501-
@pytest.mark.end_to_end
502486
def test_compile_w_bibliography_and_keep_bbl(runner, tmp_path):
503487
"""Compile a LaTeX document with bibliography."""
504488
task_source = """
@@ -542,7 +526,6 @@ def task_compile_document(
542526

543527
@needs_latexmk
544528
@skip_on_github_actions_with_win
545-
@pytest.mark.end_to_end
546529
@pytest.mark.parametrize(
547530
("step", "message"),
548531
[
@@ -582,7 +565,6 @@ def task_compile_document():
582565

583566
@needs_latexmk
584567
@skip_on_github_actions_with_win
585-
@pytest.mark.end_to_end
586568
def test_compile_latex_document_with_task_decorator(runner, tmp_path):
587569
"""Test simple compilation."""
588570
task_source = """
@@ -609,7 +591,6 @@ def compile_document():
609591

610592
@needs_latexmk
611593
@skip_on_github_actions_with_win
612-
@pytest.mark.end_to_end
613594
def test_use_task_without_path(tmp_path):
614595
task_source = """
615596
import pytask
@@ -637,7 +618,6 @@ def test_use_task_without_path(tmp_path):
637618

638619
@needs_latexmk
639620
@skip_on_github_actions_with_win
640-
@pytest.mark.end_to_end
641621
def test_collect_latex_document_with_product_from_another_task(runner, tmp_path):
642622
"""Test simple compilation."""
643623
task_source = """

tests/test_latex_dependency_scanner.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
@needs_latexmk
1414
@skip_on_github_actions_with_win
15-
@pytest.mark.end_to_end
1615
@pytest.mark.parametrize("infer_dependencies", ["true", "false"])
1716
def test_infer_dependencies_from_task(tmp_path, infer_dependencies):
1817
task_source = """

tests/test_parallel.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
@xfail_on_remote
3333
@needs_latexmk
3434
@skip_on_github_actions_with_win
35-
@pytest.mark.end_to_end
3635
def test_parallel_parametrization_over_source_files_w_loop(runner, tmp_path):
3736
source = """
3837
from pytask import mark, task
@@ -68,7 +67,6 @@ def task_compile_latex_document():
6867
@xfail_on_remote
6968
@needs_latexmk
7069
@skip_on_github_actions_with_win
71-
@pytest.mark.end_to_end
7270
def test_parallel_parametrization_over_source_file_w_loop(runner, tmp_path):
7371
source = """
7472
from pytask import mark, task

tests/test_parametrize.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import textwrap
44

5-
import pytest
65
from pytask import ExitCode
76
from pytask import build
87

@@ -12,7 +11,6 @@
1211

1312
@needs_latexmk
1413
@skip_on_github_actions_with_win
15-
@pytest.mark.end_to_end
1614
def test_parametrized_compilation_of_latex_documents_w_loop(tmp_path):
1715
source = """
1816
from pytask import mark, task
@@ -48,7 +46,6 @@ def task_compile_latex_document():
4846

4947
@needs_latexmk
5048
@skip_on_github_actions_with_win
51-
@pytest.mark.end_to_end
5249
def test_parametrizing_latex_options_w_loop(tmp_path):
5350
source = """
5451
from pytask import mark, task

0 commit comments

Comments
 (0)