diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a7bb677..a9c99c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/codecov.yml b/codecov.yml index b37c2a8..19d1f24 100644 --- a/codecov.yml +++ b/codecov.yml @@ -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/**/*" diff --git a/justfile b/justfile new file mode 100644 index 0000000..a95f3b4 --- /dev/null +++ b/justfile @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 456a6cf..7a83c76 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/tests/test_collect.py b/tests/test_collect.py index 58fca5d..6fb6bec 100644 --- a/tests/test_collect.py +++ b/tests/test_collect.py @@ -7,7 +7,6 @@ from pytask_latex.collect import latex -@pytest.mark.unit @pytest.mark.parametrize( ("kwargs", "expectation", "expected"), [ diff --git a/tests/test_config.py b/tests/test_config.py index f500c04..a80787a 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -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"] diff --git a/tests/test_execute.py b/tests/test_execute.py index f81c368..e0cbe25 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -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. @@ -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 = """ @@ -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""" @@ -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 = """ @@ -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 = """ @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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. @@ -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) @@ -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 @@ -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 = """ @@ -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 = """ @@ -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 = """ @@ -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"), [ @@ -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 = """ @@ -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 @@ -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 = """ diff --git a/tests/test_latex_dependency_scanner.py b/tests/test_latex_dependency_scanner.py index 493aa89..36b4077 100644 --- a/tests/test_latex_dependency_scanner.py +++ b/tests/test_latex_dependency_scanner.py @@ -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 = """ diff --git a/tests/test_parallel.py b/tests/test_parallel.py index ec94c6b..a32104d 100644 --- a/tests/test_parallel.py +++ b/tests/test_parallel.py @@ -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 @@ -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 diff --git a/tests/test_parametrize.py b/tests/test_parametrize.py index 4965c1c..8204499 100644 --- a/tests/test_parametrize.py +++ b/tests/test_parametrize.py @@ -2,7 +2,6 @@ import textwrap -import pytest from pytask import ExitCode from pytask import build @@ -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 @@ -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