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
47 changes: 46 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
# manually triggered

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -32,3 +32,48 @@ jobs:
uv pip install ".[testing]"
.venv/bin/pytest tests --cov=pact
.venv/bin/pylint --rcfile=.pylintrc pact tests

docs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@main
- name: Install the default version of uv
id: setup-uv
uses: astral-sh/setup-uv@v3
- name: Building docs
run: |
uv venv --python 3.11
uv pip install ".[doc]"
.venv/bin/sphinx-build -a -W -E doc build/sphinx/html

publish:
if: startsWith(github.ref, 'refs/tags/')
needs: test
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install hatch
run: pip install hatch

- name: Build package
run: hatch build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
skip-existing: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ dist
htmlcov
AUTHORS
ChangeLog
.venv
28 changes: 28 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: doc/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
install:
- method: pip
path: .
extra_requirements:
- doc
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test: env

env:
uv venv
uv pip install -e ".[testing]"
uv pip install -e ".[testing,doc]"

doc: env
.venv/bin/sphinx-build -a -W -E doc build/sphinx/html
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# serve to show the default.

import alabaster
import pkg_resources
import importlib.metadata

nitpicky = True

Expand Down Expand Up @@ -59,7 +59,7 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
version = release = pkg_resources.get_distribution('pact').version
version = release = importlib.metadata.distribution('pact').version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
6 changes: 3 additions & 3 deletions tests/test_pact_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_group_wait_during(checkpoint, timed_group, num_seconds):
assert checkpoint.called_times == num_seconds + 1


def test_group_wait_then(checkpoint, checkpoint1, checkpoint2, checkpoint3, timed_group, timed_pact):
def test_group_wait_then(*, checkpoint, checkpoint1, checkpoint2, checkpoint3, timed_group, timed_pact):
timed_group.lastly(checkpoint1)
timed_group.then(checkpoint)
timed_pact.then(checkpoint2)
Expand Down Expand Up @@ -74,7 +74,7 @@ def get_timeout_exception(self, exc_info):
group.wait()


def test_group_without_absorb(pred1, pred2, checkpoint, checkpoint1, checkpoint2, checkpoint3):
def test_group_without_absorb(*, pred1, pred2, checkpoint, checkpoint1, checkpoint2, checkpoint3):
p1 = Pact('a').until(pred1).lastly(checkpoint).then(checkpoint1)
p2 = Pact('b').until(pred2).then(checkpoint2).lastly(checkpoint3)
group = p1 + p2
Expand All @@ -91,7 +91,7 @@ def test_group_without_absorb(pred1, pred2, checkpoint, checkpoint1, checkpoint2
assert checkpoint3.called


def test_group_with_absorb(pred1, pred2, checkpoint, checkpoint1, checkpoint2, checkpoint3):
def test_group_with_absorb(*, pred1, pred2, checkpoint, checkpoint1, checkpoint2, checkpoint3):
# pylint: disable=protected-access
p1 = Pact('a').until(pred1).lastly(checkpoint).then(checkpoint1)
p2 = Pact('b').until(pred2).then(checkpoint2).lastly(checkpoint3)
Expand Down