Skip to content

Latest commit

 

History

History
84 lines (54 loc) · 2.95 KB

test-python-poetry-task.md

File metadata and controls

84 lines (54 loc) · 2.95 KB

"Test Python" workflow (Poetry, Task)

Run pytest-based Python tests.

This is the version of the workflow for projects using the Task task runner tool.

Installation

Workflow

Install the test-python-poetry-task.yml GitHub Actions workflow to .github/workflows/

Assets

  • Taskfile.yml - Test runner task.
    • Install to: repository root (or merge into the existing Taskfile.yml).
  • Taskfile.yml - Installation task.
    • Merge into Taskfile.yml
  • __init__.py - Python module file.
    • Install to: tests/
  • pytest.ini - pytest configuration file.
    • Install to: tests/
  • .gitignore
    • Install to: repository root (or merge into the existing .gitignore).

Dependencies

The Python dependencies are managed by Poetry.

Install Poetry by following these instructions:
https://python-poetry.org/docs/#installation

If your project does not already use Poetry, you can initialize the pyproject.toml file using these commands:

poetry init --python="^3.9" --dev-dependency="pytest@^8.3.5"
poetry install

If already using Poetry, add the tool using this command:

poetry add --dev "pytest@^8.3.5"

Commit the resulting pyproject.toml and poetry.lock files.

Configuration

Configure the version of Python used for development of the project in the env.PYTHON_VERSION field of test-go-integration-task.yml.

Readme badge

Markdown badge:

[![Test Python status](https://github.com/TODO_REPO_OWNER/TODO_REPO_NAME/actions/workflows/test-python-poetry-task.yml/badge.svg)](https://github.com/TODO_REPO_OWNER/TODO_REPO_NAME/actions/workflows/test-python-poetry-task.yml)

Replace the TODO_REPO_OWNER and TODO_REPO_NAME placeholders in the URLs with the final repository owner and name (example).


Asciidoc badge:

image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/test-python-poetry-task.yml/badge.svg["Test Python status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/test-python-poetry-task.yml"]

Define the {repository-owner} and {repository-name} attributes and use them throughout the readme (example).

Commit message

Add CI workflow to run Python tests

On every push and pull request that affects relevant files, run the pytest-based Python tests.

PR message

On every push and pull request that affects relevant files, run the [pytest](https://pytest.org)-based Python tests.