Skip to content
Open
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
9 changes: 0 additions & 9 deletions .coveragerc

This file was deleted.

42 changes: 29 additions & 13 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,44 @@ or the Feature you have in mind.

We are very happy to receive Pull Requests considering:

* Style Guide. Follow the rules of [PEP8](http://legacy.python.org/dev/peps/pep-0008/) and make sure `tox -e lint` passes on your changes.
* Style Guide. Follow the rules of [PEP8](http://legacy.python.org/dev/peps/pep-0008/) and make sure `ruff format` and `ruff check --fix` passes on your changes.
* Tests. Make sure your code is covered by an automated test case. Make sure all tests pass.

## Development

radish can be installed as [editable install](https://setuptools.pypa.io/en/latest/userguide/development_mode.html).
Install the development dependencies with [uv](https://docs.astral.sh/uv/getting-started/installation/) this will create a virtual environment for you and install all dependencies there.
Make sure to install with `--all-extras` so that all optional dependencies are installed as well.

```bash
pip install -r requirements-dev.txt
pip install -e .
uv sync --all-extras
```

### tox: linting, testing, docs & more
### Linting & Formatting

radish uses [`tox`](https://tox.readthedocs.io/en/latest/) to automate development tasks,
like linting, testing, building the docs and creating the changelog.
Radish uses [ruff](https://docs.astral.sh/ruff/) for linting and formatting the code base.

The radish tox setup provides the following automated tasks:
```bash
uv run ruff check --fix
uv run format .
```

### Testing

To run the tests you can use pytest.

```bash
uv run pytest
```

* `lint`: formats and lints the code base using [`ruff`](https://docs.astral.sh/ruff/)
* `py<ver>`: runs tests with the Python Version from `<ver>`.
If you want to run the tests for a specific Python version you can use `uv` to do so:

Before commiting your changes, it's a good practice to run `tox`.
So that it'll run all the preconfigured tasks.
If they all pass - you are good to go for a Pull Request! :tada:
Make sure you have installed the development dependencies with that specific Python version first.

```bash
uv python install 3.10
```
Then you can run the tests like this (`--all-extras` since some tests require optional dependencies) (`--isolated` to avoid interference with the current environment):

```bash
uv run --isolated --python=3.11 --all-extras pytest
```
30 changes: 20 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,35 @@ on:
types: [published]

jobs:
deploy:

publish-pypi:
# Based off the uv instructions https://docs.astral.sh/uv/guides/integration/github/#publishing-to-pypi
runs-on: ubuntu-latest

permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
contents: read

steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Build package
run: python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
run: uv build
- name: Smoke test (wheel) # Check that the built wheel can be installed and radish commands run
run: |
python -m venv whl-venv
./whl-venv/bin/pip install $(find dist/ -name "*.whl")[testing]
./whl-venv/bin/radish --version
./whl-venv/bin/radish-test --version
- name: Smoke test (source distribution) # Check that the built sdist can be installed and radish commands run
run: |
python -m venv sdist-venv
./sdist-venv/bin/pip install $(find dist/ -name "*.whl")[testing]
./sdist-venv/bin/radish --version
./sdist-venv/bin/radish-test --version
- name: Publish
run: uv publish
46 changes: 22 additions & 24 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,22 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python 3.14
uses: actions/setup-python@v6
with:
python-version: 3.14
- name: Setup and install tools
run: python -m pip install ruff
- name: ruff format check
run: ruff format --check
- name: ruff check
run: ruff check
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3

test:
strategy:
fail-fast: false
max-parallel: 8
matrix:
python-version: [3.7, 3.14]
# python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
python-version: [3.7, 3.8, 3.14]
os: [ubuntu-22.04, windows-latest, macos-latest]
exclude:
- os: macos-latest
python-version: 3.7
- os: windows-latest # wierd bug with windows and python 3.7 and uv
python-version: 3.7

runs-on: ${{ matrix.os }}
steps:
Expand All @@ -36,29 +30,31 @@ jobs:
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Setup build and test environment
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Build Python Package
- name: Install uv # UV could be used to install python, but only has >=3.8 support
uses: astral-sh/setup-uv@v6
with:
version: "0.9.8"
enable-cache: true
- name: Install dependencies
run: |
python -m pip install -r requirements-dev.txt
uv sync --locked --all-extras --dev
- name: Unit Test with pytest
run: |
coverage run -p --source radish -m pytest tests/unit/ --junitxml=junit/unit-test-results.xml
uv run coverage run -m pytest tests/unit/ --junitxml=junit/unit-test-results.xml
- name: Functional Test with pytest
run: |
coverage run -p --source radish -m pytest tests/functional/ --junitxml=junit/functional-test-results.xml
uv run coverage run -m pytest tests/functional/ --junitxml=junit/functional-test-results.xml
- name: Integration Test with pytest
run: |
coverage run -p --source radish -m pytest tests/integration/ --junitxml=junit/integration-test-results.xml
uv run coverage run -m pytest tests/integration/ --junitxml=junit/integration-test-results.xml
env:
PYTHONIOENCODING: UTF-8
- name: Report code coverage
run: |
coverage combine
coverage report
coverage xml
coverage html
uv run coverage combine
uv run coverage report
uv run coverage xml
uv run coverage html
- name: Upload coverage to Codecov
# codecov only runs on Linux
if: startsWith(matrix.os, 'ubuntu-')
Expand All @@ -68,3 +64,5 @@ jobs:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
- name: Minimize uv cache
run: uv cache prune --ci
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ README.rst
# IDE configuration
.idea/
.venv/
.vscode/
.vscode/
# junit test result files
junit/
104 changes: 104 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,117 @@
[project]
name = "radish_bdd"
version = "0.18.2"
authors = [{ name = "Timo Furrer", email = "[email protected]" }]
description = "Behaviour-Driven-Development tool for Python"
license = { file = "LICENSE" }
readme = "README.md"
requires-python = ">=3.7,<4.0"
classifiers = [
"Development Status :: 6 - Mature",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Other Audience",
"Natural Language :: English",
"Operating System :: OS Independent",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation",
"Topic :: Education :: Testing",
"Topic :: Software Development",
"Topic :: Software Development :: Testing",
]
dependencies = [
"importlib_metadata>=6.0.0; python_version < '3.8'",
"colorful>=0.5.6",
"docopt>=0.6.2",
"tag-expressions>=2.0.0",
"parse-type>=0.6.4",
"humanize>=4.6.0",
]

[project.optional-dependencies]
bddxml = ["lxml>=5.3.0"]
ipython-debugger = ["ipython>=7.34.0"]
coverage = ["coverage[toml]~=7.2.7"]
testing = ["pyyaml>=6.0.1"]

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
where = [""] # Not using src layout


[project.scripts]
radish = "radish.main:main"
radish-test = "radish.testing.__main__:main"

[project.urls]
Homepage = "https://radish-bdd.github.io"
Download="https://github.com/radish-bdd/radish"
Changelog="https://github.com/radish-bdd/radish/CHANGELOG.md"
Documentation = "https://radish-bdd.github.io"
Bug = "https://github.com/radish-bdd/radish/issues"


[tool.ruff]
line-length = 120
# Rule descriptions: https://docs.astral.sh/ruff/rules/
# TODO enable more linter
#lint.select = ["B", "N", "C90", "ARG", "PL", "RUF", "UP"]
lint.select = ["E", "F", "W", "I", "C4"]

[dependency-groups]
dev = [
{include-group = "lint"},
{include-group = "test"},
{include-group = "docs"},
]
lint = [
"ruff~=0.9.7",
]
test = [
"freezegun==1.5.1",
"pytest==7.4.4",
"pytest-mock==3.11.1",
"pyyaml==6.0.1"
]
docs = [
"sphinx==5.3.0",
]

[tool.ruff.lint.per-file-ignores]
# We use magic values in tests
"tests/*" = ["PLR2004"]
# There is a lot to look at with this rule,
# not enforced yet
"*" = ["F401"]

[tool.coverage.run]
source = ["radish"]
parallel = true
omit = [
"tests/*",
"radish/vendor/*",
]
[tool.coverage.paths]
tox = [
"radish/",
".tox/py*/lib/python*/site-packages/radish/",
]
16 changes: 7 additions & 9 deletions radish/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
__DESCRIPTION__ = "Behaviour-Driven-Development tool for Python"
__LICENSE__ = "MIT"
__VERSION__ = "0.18.3"
__AUTHOR__ = "Timo Furrer"
__AUTHOR_EMAIL__ = "[email protected]"
__URL__ = "https://radish-bdd.github.io"
__DOWNLOAD_URL__ = "https://github.com/radish-bdd/radish"
__BUGTRACK_URL__ = "https://github.com/radish-bdd/radish/issues"

# export some functions for users
from .customtyperegistry import TypeBuilder, custom_type, register_custom_type
from .exceptions import ValidationError
from .extensionregistry import extension
from .hookregistry import after, before
from .stepregistry import given, step, steps, then, when
from .terrain import pick, world

try:
from importlib.metadata import version
except ImportError:
# for Python<3.8
from importlib_metadata import version
__VERSION__ = version("radish-bdd")
6 changes: 0 additions & 6 deletions requirements-dev.txt

This file was deleted.

10 changes: 0 additions & 10 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

Loading
Loading