Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,11 @@ jobs:
enable-cache: true
python-version: ${{ matrix.python-version }}

# Unit, integration, and end-to-end tests.

- name: Run unit tests and doctests.
shell: bash -l {0}
run: uv run --extra test pytest -m "unit or (not integration and not end_to_end)" --cov=./ --cov-report=xml -n auto

- name: Upload coverage report for unit tests and doctests.
if: runner.os == 'Linux' && matrix.python-version == '3.10'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F unit -c

- name: Run end-to-end tests.
- name: Run tests
shell: bash -l {0}
run: uv run --extra test pytest -m end_to_end --cov=./ --cov-report=xml -n auto
run: uv run --extra test pytest --cov=./ --cov-report=xml -n auto

- name: Upload coverage reports of end-to-end tests.
- name: Upload coverage report
if: runner.os == 'Linux' && matrix.python-version == '3.10'
shell: bash -l {0}
run: bash <(curl -s https://codecov.io/bash) -F end_to_end -c
run: bash <(curl -s https://codecov.io/bash) -c
12 changes: 0 additions & 12 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ coverage:
project:
default:
threshold: 1%
unit:
threshold: 1%
flags:
- unit
integration:
threshold: 1%
flags:
- integration
end_to_end:
threshold: 1%
flags:
- end_to_end

ignore:
- ".tox/**/*"
Expand Down
22 changes: 22 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Install all dependencies
install:
uv sync --all-groups

# Run tests
test *FLAGS:
uv run --group test pytest {{FLAGS}}

# Run tests with coverage
test-cov *FLAGS:
uv run --group test pytest --cov=./ --cov-report=xml -n auto {{FLAGS}}

# Run type checking
typing:
uv run --group typing --group test ty check src/ tests/

# Run linting
lint:
uvx prek run -a

# Run all checks (format, lint, typing, test)
check: lint typing test
6 changes: 0 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,4 @@ unused-ignore-comment = "ignore"

[tool.pytest.ini_options]
testpaths = ["src", "tests"]
markers = [
"wip: Tests that are work-in-progress.",
"unit: Flag for unit tests which target mainly a single function.",
"integration: Flag for integration tests which may comprise of multiple unit tests.",
"end_to_end: Flag for tests that cover the whole program.",
]
norecursedirs = [".idea", ".tox"]
1 change: 0 additions & 1 deletion tests/test_collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from pytask_latex.collect import latex


@pytest.mark.unit
@pytest.mark.parametrize(
("kwargs", "expectation", "expected"),
[
Expand Down
2 changes: 0 additions & 2 deletions tests/test_config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from __future__ import annotations

import pytest
from pytask import build


@pytest.mark.end_to_end
def test_marker_is_configured(tmp_path):
session = build(paths=tmp_path)
assert "latex" in session.config["markers"]
20 changes: 0 additions & 20 deletions tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from tests.conftest import skip_on_github_actions_with_win


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

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_latex_document(runner, tmp_path):
"""Test simple compilation."""
task_source = """
Expand All @@ -64,7 +62,6 @@ def task_compile_document():

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_latex_document_w_relative(runner, tmp_path):
"""Test simple compilation."""
task_source = f"""
Expand Down Expand Up @@ -96,7 +93,6 @@ def task_compile_document():

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_latex_document_to_different_name(runner, tmp_path):
"""Compile a LaTeX document where source and output name differ."""
task_source = """
Expand All @@ -123,7 +119,6 @@ def task_compile_document():

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_w_bibliography(runner, tmp_path):
"""Compile a LaTeX document with bibliography."""
task_source = """
Expand Down Expand Up @@ -162,7 +157,6 @@ def task_compile_document():


@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_raise_error_if_latexmk_is_not_found(tmp_path, monkeypatch):
task_source = """
from pytask import mark
Expand Down Expand Up @@ -197,7 +191,6 @@ def task_compile_document():


@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_skip_even_if_latexmk_is_not_found(tmp_path, monkeypatch):
task_source = """
from pytask import mark
Expand Down Expand Up @@ -234,7 +227,6 @@ def task_compile_document():

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_latex_document_w_xelatex(runner, tmp_path):
task_source = """
from pytask import mark
Expand Down Expand Up @@ -269,7 +261,6 @@ def task_compile_document():

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_latex_document_w_two_dependencies(runner, tmp_path):
task_source = """
from pytask import mark
Expand Down Expand Up @@ -297,7 +288,6 @@ def task_compile_document(path: Path = Path("in.txt")):

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_fail_because_script_is_not_latex(tmp_path):
task_source = """
from pytask import mark
Expand Down Expand Up @@ -327,7 +317,6 @@ def task_compile_document(path: Path = Path("in.txt")):

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_document_to_out_if_document_has_relative_resources(tmp_path):
"""Test that motivates the ``"--cd"`` flag.

Expand Down Expand Up @@ -370,7 +359,6 @@ def task_compile_document(path: Path = Path("resources/content.tex")):

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_document_w_wrong_flag(tmp_path):
"""Test that wrong flags raise errors."""
tmp_path.joinpath("sub").mkdir(parents=True)
Expand Down Expand Up @@ -407,7 +395,6 @@ def task_compile_document():


@needs_latexmk
@pytest.mark.end_to_end
def test_compile_document_w_image(runner, tmp_path):
task_source = f"""
from pytask import Product
Expand Down Expand Up @@ -443,7 +430,6 @@ def task_compile_document():

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_latex_document_w_multiple_marks(runner, tmp_path):
"""Test simple compilation."""
task_source = """
Expand Down Expand Up @@ -471,7 +457,6 @@ def task_compile_document():

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_latex_document_with_wrong_extension(runner, tmp_path):
"""Test simple compilation."""
task_source = """
Expand All @@ -498,7 +483,6 @@ def task_compile_document():

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_w_bibliography_and_keep_bbl(runner, tmp_path):
"""Compile a LaTeX document with bibliography."""
task_source = """
Expand Down Expand Up @@ -542,7 +526,6 @@ def task_compile_document(

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
@pytest.mark.parametrize(
("step", "message"),
[
Expand Down Expand Up @@ -582,7 +565,6 @@ def task_compile_document():

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_compile_latex_document_with_task_decorator(runner, tmp_path):
"""Test simple compilation."""
task_source = """
Expand All @@ -609,7 +591,6 @@ def compile_document():

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_use_task_without_path(tmp_path):
task_source = """
import pytask
Expand Down Expand Up @@ -637,7 +618,6 @@ def test_use_task_without_path(tmp_path):

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_collect_latex_document_with_product_from_another_task(runner, tmp_path):
"""Test simple compilation."""
task_source = """
Expand Down
1 change: 0 additions & 1 deletion tests/test_latex_dependency_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
@pytest.mark.parametrize("infer_dependencies", ["true", "false"])
def test_infer_dependencies_from_task(tmp_path, infer_dependencies):
task_source = """
Expand Down
2 changes: 0 additions & 2 deletions tests/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
@xfail_on_remote
@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_parallel_parametrization_over_source_files_w_loop(runner, tmp_path):
source = """
from pytask import mark, task
Expand Down Expand Up @@ -68,7 +67,6 @@ def task_compile_latex_document():
@xfail_on_remote
@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_parallel_parametrization_over_source_file_w_loop(runner, tmp_path):
source = """
from pytask import mark, task
Expand Down
3 changes: 0 additions & 3 deletions tests/test_parametrize.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import textwrap

import pytest
from pytask import ExitCode
from pytask import build

Expand All @@ -12,7 +11,6 @@

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_parametrized_compilation_of_latex_documents_w_loop(tmp_path):
source = """
from pytask import mark, task
Expand Down Expand Up @@ -48,7 +46,6 @@ def task_compile_latex_document():

@needs_latexmk
@skip_on_github_actions_with_win
@pytest.mark.end_to_end
def test_parametrizing_latex_options_w_loop(tmp_path):
source = """
from pytask import mark, task
Expand Down