diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ba6b2284..69090c5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - '3.9' - '3.10' - '3.11' - tests: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -28,8 +28,8 @@ jobs: cache: pip python-version: ${{ matrix.python-version }} - run: env | sort - - run: make dev-tests - - run: make tests + - run: make dev-test + - run: make test - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/ci.yml.jinja b/.github/workflows/ci.yml.jinja index d26ea8c3..980f96cd 100644 --- a/.github/workflows/ci.yml.jinja +++ b/.github/workflows/ci.yml.jinja @@ -27,7 +27,7 @@ jobs: {%- if version_between("3.11", minimal_python_version, maximal_python_version) | bool %} - '3.11' {%- endif %} - tests: + test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -37,8 +37,8 @@ jobs: cache: pip python-version: {{ '${{ matrix.python-version }}' }} - run: env | sort - - run: make dev-tests - - run: make tests + - run: make dev-test + - run: make test - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b3bce38a..ab35337d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,7 +22,7 @@ lint: - make dev-lint - make lint-check stage: lint_test -tests: +test: artifacts: reports: coverage_report: @@ -44,8 +44,8 @@ tests: - '3.11' script: - env | sort - - make dev-tests - - make tests + - make dev-test + - make test stage: lint_test package: only: diff --git a/.gitlab-ci.yml.jinja b/.gitlab-ci.yml.jinja index 6d8bd9bb..43a20f38 100644 --- a/.gitlab-ci.yml.jinja +++ b/.gitlab-ci.yml.jinja @@ -31,7 +31,7 @@ lint: - make dev-lint - make lint-check stage: lint_test -tests: +test: artifacts: reports: coverage_report: @@ -61,8 +61,8 @@ tests: {%- endif %} script: - env | sort - - make dev-tests - - make tests + - make dev-test + - make test stage: lint_test package: only: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff4cc8d4..23ffb7ea 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,7 +23,7 @@ repos: - requirements/docs.txt - requirements/lint.txt - requirements/package.txt - - requirements/tests.txt + - requirements/test.txt id: requirements-txt-fixer - files: .pre-commit-config.yaml id: sort-simple-yaml diff --git a/.vscode/settings.json b/.vscode/settings.json index f1ceaacf..a93b6d9b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -86,7 +86,7 @@ "stages", "default", "lint", - "tests", + "test", "package", "pages", "release", diff --git a/Makefile b/Makefile index 3b88b8a7..7cce668e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: clean deepclean install dev black isort mypy ruff toml-sort lint pre-commit tests freeze version build upload docs docs-autobuild docs-coverage reports docs-all +.PHONY: clean deepclean install dev black isort mypy ruff toml-sort lint pre-commit test freeze version build upload docs docs-autobuild docs-coverage reports docs-all ######################################################################################## # Variables @@ -48,7 +48,7 @@ dev-%: # Prepare the development environment. # Install the pacakge in editable mode with all optional dependencies and pre-commit hoook. dev: - ${PIPRUN} pip install -e .[docs,lint,package,tests] -c constraints/$(or $(SS_CONSTRAINTS_VERSION),default).txt + ${PIPRUN} pip install -e .[docs,lint,package,test] -c constraints/$(or $(SS_CONSTRAINTS_VERSION),default).txt if [ "${CI}" != "true" ] && command -v pre-commit > /dev/null 2>&1; then pre-commit install --hook-type pre-push; fi ######################################################################################## @@ -57,7 +57,7 @@ dev: # Check lint with black. black: - ${PIPRUN} python -m black --check docs tests src + ${PIPRUN} python -m black --check docs test src # Check lint with isort. isort: @@ -65,11 +65,11 @@ isort: # Check lint with mypy. mypy: - ${PIPRUN} python -m mypy docs tests src + ${PIPRUN} python -m mypy docs test src # Check lint with ruff. ruff: - ${PIPRUN} python -m ruff docs tests src + ${PIPRUN} python -m ruff docs test src # Check lint with toml-sort. toml-sort: @@ -83,11 +83,11 @@ lint: pre-commit run --all-files ######################################################################################## -# Tests +# Test ######################################################################################## -# Run tests with coverage report. -tests: +# Run test with coverage report. +test: ${PIPRUN} python -m coverage erase ${PIPRUN} python -m coverage run -m pytest ${PIPRUN} python -m coverage report @@ -126,7 +126,7 @@ docs-autobuild: # Generate mypy reports. docs-mypy: - ${PIPRUN} python -m mypy tests src --html-report ${PUBLIC_DIR}/reports/mypy + ${PIPRUN} python -m mypy test src --html-report ${PUBLIC_DIR}/reports/mypy # Generate coverage reports. docs-coverage: diff --git a/Makefile.jinja b/Makefile.jinja index a771e9f0..fb980f19 100644 --- a/Makefile.jinja +++ b/Makefile.jinja @@ -1,4 +1,4 @@ -.PHONY: clean deepclean install dev black isort mypy ruff toml-sort lint pre-commit tests freeze version build upload docs docs-autobuild docs-coverage reports docs-all +.PHONY: clean deepclean install dev black isort mypy ruff toml-sort lint pre-commit test freeze version build upload docs docs-autobuild docs-coverage reports docs-all ######################################################################################## # Variables @@ -50,7 +50,7 @@ dev-%: # Prepare the development environment. # Install the pacakge in editable mode with all optional dependencies and pre-commit hoook. dev: - ${PIPRUN} pip install -e .[docs,lint,package,tests] -c constraints/$(or $(SS_CONSTRAINTS_VERSION),default).txt + ${PIPRUN} pip install -e .[docs,lint,package,test] -c constraints/$(or $(SS_CONSTRAINTS_VERSION),default).txt if [ "${CI}" != "true" ] && command -v pre-commit > /dev/null 2>&1; then pre-commit install --hook-type pre-push; fi ######################################################################################## @@ -59,7 +59,7 @@ dev: # Check lint with black. black: - ${PIPRUN} python -m black --check docs tests src + ${PIPRUN} python -m black --check docs test src # Check lint with isort. isort: @@ -67,11 +67,11 @@ isort: # Check lint with mypy. mypy: - ${PIPRUN} python -m mypy docs tests src + ${PIPRUN} python -m mypy docs test src # Check lint with ruff. ruff: - ${PIPRUN} python -m ruff docs tests src + ${PIPRUN} python -m ruff docs test src # Check lint with toml-sort. toml-sort: @@ -85,11 +85,11 @@ lint: pre-commit run --all-files ######################################################################################## -# Tests +# Test ######################################################################################## -# Run tests with coverage report. -tests: +# Run test with coverage report. +test: ${PIPRUN} python -m coverage erase ${PIPRUN} python -m coverage run -m pytest ${PIPRUN} python -m coverage report @@ -128,7 +128,7 @@ docs-autobuild: # Generate mypy reports. docs-mypy: - ${PIPRUN} python -m mypy tests src --html-report ${PUBLIC_DIR}/reports/mypy + ${PIPRUN} python -m mypy test src --html-report ${PUBLIC_DIR}/reports/mypy # Generate coverage reports. docs-coverage: diff --git a/README.md b/README.md index f777d87e..644eeadd 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ A development-focused Python project template with various integrations, configu [![Serious Scaffold Python](docs/_static/images/logo.svg)](https://github.com/serious-scaffold/serious-scaffold-python) -Setting up a project often involves more than just establishing a basic project structure. It involves tasks like integrating GitHub Actions or GitLab CI/CD, configuring linters, tests and documentation, as well as implementing settings, logging and other frequently used modules. [Serious Scaffold Python](https://github.com/serious-scaffold/serious-scaffold-python) streamlines this process. Powered by [`copier`](https://copier.readthedocs.io/), bootstrapping a new Python project can be done with a single command. By answering a few questions, the project will be fully configured and ready for development. Furthermore, the project can be updated alongside the advancement of the template. +Setting up a project often involves more than just establishing a basic project structure. It involves tasks like integrating GitHub Actions or GitLab CI/CD, configuring lint, test and documentation, as well as implementing settings, logging and other frequently used modules. [Serious Scaffold Python](https://github.com/serious-scaffold/serious-scaffold-python) streamlines this process. Powered by [`copier`](https://copier.readthedocs.io/), bootstrapping a new Python project can be done with a single command. By answering a few questions, the project will be fully configured and ready for development. Furthermore, the project can be updated alongside the advancement of the template. If you find this helpful, please consider [sponsorship](https://github.com/sponsors/huxuan). diff --git a/README.md.jinja b/README.md.jinja index 5b89586d..c1db7b64 100644 --- a/README.md.jinja +++ b/README.md.jinja @@ -18,7 +18,7 @@ [![{{ project_name }}](docs/_static/images/logo.svg)](https://github.com/{{ repo_namespace }}/{{ repo_name }}) -Setting up a project often involves more than just establishing a basic project structure. It involves tasks like integrating GitHub Actions or GitLab CI/CD, configuring linters, tests and documentation, as well as implementing settings, logging and other frequently used modules. [Serious Scaffold Python](https://github.com/serious-scaffold/serious-scaffold-python) streamlines this process. Powered by [`copier`](https://copier.readthedocs.io/), bootstrapping a new Python project can be done with a single command. By answering a few questions, the project will be fully configured and ready for development. Furthermore, the project can be updated alongside the advancement of the template. +Setting up a project often involves more than just establishing a basic project structure. It involves tasks like integrating GitHub Actions or GitLab CI/CD, configuring lint, test and documentation, as well as implementing settings, logging and other frequently used modules. [Serious Scaffold Python](https://github.com/serious-scaffold/serious-scaffold-python) streamlines this process. Powered by [`copier`](https://copier.readthedocs.io/), bootstrapping a new Python project can be done with a single command. By answering a few questions, the project will be fully configured and ready for development. Furthermore, the project can be updated alongside the advancement of the template. If you find this helpful, please consider [sponsorship](https://github.com/sponsors/{{ author_name }}). diff --git a/pyproject.toml b/pyproject.toml index 1ee24b60..8e2a72c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,7 +98,7 @@ src = ["src"] [tool.ruff.per-file-ignores] "docs/conf.py" = ["INP001"] "src/\\{\\{ module_name \\}\\}/__init__.py" = ["N999"] -"tests/*" = ["S101"] +"test/*" = ["S101"] [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} @@ -107,7 +107,7 @@ dependencies = {file = ["requirements.txt"]} docs = {file = ["requirements/docs.txt"]} lint = {file = ["requirements/lint.txt"]} package = {file = ["requirements/package.txt"]} -tests = {file = ["requirements/tests.txt"]} +test = {file = ["requirements/test.txt"]} [tool.setuptools_scm] diff --git a/pyproject.toml.jinja b/pyproject.toml.jinja index f0d894ff..96e1d44c 100644 --- a/pyproject.toml.jinja +++ b/pyproject.toml.jinja @@ -111,7 +111,7 @@ src = ["src"] [tool.ruff.per-file-ignores] "docs/conf.py" = ["INP001"] "src/\\{\\{ module_name \\}\\}/__init__.py" = ["N999"] -"tests/*" = ["S101"] +"test/*" = ["S101"] [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} @@ -120,7 +120,7 @@ dependencies = {file = ["requirements.txt"]} docs = {file = ["requirements/docs.txt"]} lint = {file = ["requirements/lint.txt"]} package = {file = ["requirements/package.txt"]} -tests = {file = ["requirements/tests.txt"]} +test = {file = ["requirements/test.txt"]} [tool.setuptools_scm] diff --git a/requirements/test.txt b/requirements/test.txt new file mode 100644 index 00000000..4b4fbc0b --- /dev/null +++ b/requirements/test.txt @@ -0,0 +1,3 @@ +# Requirements for test. +coverage +pytest diff --git a/requirements/tests.txt b/requirements/tests.txt deleted file mode 100644 index 30335870..00000000 --- a/requirements/tests.txt +++ /dev/null @@ -1,3 +0,0 @@ -# Requirements for tests. -coverage -pytest diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 00000000..6f62d034 --- /dev/null +++ b/test/__init__.py @@ -0,0 +1 @@ +"""Init for the test.""" diff --git a/tests/cli_test.py b/test/cli_test.py similarity index 79% rename from tests/cli_test.py rename to test/cli_test.py index 8f7268e3..cbbf318e 100644 --- a/tests/cli_test.py +++ b/test/cli_test.py @@ -1,4 +1,4 @@ -"""Tests for cli.""" +"""Test for cli.""" from typer.testing import CliRunner from serious_scaffold.cli import app @@ -7,14 +7,14 @@ def test_cli() -> None: - """Tests for cli.""" + """Test for cli.""" result = runner.invoke(app) assert result.exit_code == 0 assert "Usage" in result.output def test_cli_run() -> None: - """Tests for run subcommand of the cli.""" + """Test for run subcommand of the cli.""" result = runner.invoke(app, "run") assert result.exit_code == 0 assert not result.output diff --git a/tests/cli_test.py.jinja b/test/cli_test.py.jinja similarity index 79% rename from tests/cli_test.py.jinja rename to test/cli_test.py.jinja index 09139c1b..3ac3d905 100644 --- a/tests/cli_test.py.jinja +++ b/test/cli_test.py.jinja @@ -1,4 +1,4 @@ -"""Tests for cli.""" +"""Test for cli.""" from typer.testing import CliRunner from {{ module_name }}.cli import app @@ -7,14 +7,14 @@ runner = CliRunner() def test_cli() -> None: - """Tests for cli.""" + """Test for cli.""" result = runner.invoke(app) assert result.exit_code == 0 assert "Usage" in result.output def test_cli_run() -> None: - """Tests for run subcommand of the cli.""" + """Test for run subcommand of the cli.""" result = runner.invoke(app, "run") assert result.exit_code == 0 assert not result.output diff --git a/tests/pkg_test.py b/test/pkg_test.py similarity index 71% rename from tests/pkg_test.py rename to test/pkg_test.py index 35e7fbe5..a09346bb 100644 --- a/tests/pkg_test.py +++ b/test/pkg_test.py @@ -1,8 +1,8 @@ -"""Tests for pkg.""" +"""Test for pkg.""" import serious_scaffold def test_pkg() -> None: - """Tests for pkg.""" + """Test for pkg.""" assert serious_scaffold.__package__ == "serious_scaffold" diff --git a/tests/pkg_test.py.jinja b/test/pkg_test.py.jinja similarity index 71% rename from tests/pkg_test.py.jinja rename to test/pkg_test.py.jinja index 20a8a7e9..a6acf16e 100644 --- a/tests/pkg_test.py.jinja +++ b/test/pkg_test.py.jinja @@ -1,8 +1,8 @@ -"""Tests for pkg.""" +"""Test for pkg.""" import {{ module_name }} def test_pkg() -> None: - """Tests for pkg.""" + """Test for pkg.""" assert {{ module_name }}.__package__ == "{{ module_name }}" diff --git a/tests/settings_test.py b/test/settings_test.py similarity index 84% rename from tests/settings_test.py rename to test/settings_test.py index 771b1881..a28ba335 100644 --- a/tests/settings_test.py +++ b/test/settings_test.py @@ -1,11 +1,11 @@ -"""Tests for settings.""" +"""Test for settings.""" import os from serious_scaffold.settings import global_settings, settings def test_settings() -> None: - """Tests for settings.""" + """Test for settings.""" assert settings.logging_level == os.getenv( "SERIOUS_SCAFFOLD_LOGGING_LEVEL", "INFO", diff --git a/tests/settings_test.py.jinja b/test/settings_test.py.jinja similarity index 84% rename from tests/settings_test.py.jinja rename to test/settings_test.py.jinja index 4ba8a225..31796f41 100644 --- a/tests/settings_test.py.jinja +++ b/test/settings_test.py.jinja @@ -1,11 +1,11 @@ -"""Tests for settings.""" +"""Test for settings.""" import os from {{ module_name }}.settings import global_settings, settings def test_settings() -> None: - """Tests for settings.""" + """Test for settings.""" assert settings.logging_level == os.getenv( "{{ module_name|upper }}_LOGGING_LEVEL", "INFO", diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index 10a74908..00000000 --- a/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Init for the tests."""