Skip to content

Commit

Permalink
chore: update Python to 3.12 and Poetry to 1.7 (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcous committed Nov 7, 2023
1 parent 86d61db commit 781397a
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 34 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
quote_type = double
17 changes: 12 additions & 5 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ description: "Install development dependencies"
inputs:
python-version:
description: "Python version to install"
default: "3.11"
default: "3.12"
poetry-version:
description: "Poetry version to install"
default: "1.5.1"
default: "1.7.0"
cache:
description: "Cache directory"
default: "${{ runner.temp }}/cache"
Expand All @@ -20,12 +20,18 @@ runs:
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
allow-prereleases: true
update-environment: false

- name: "Set up Python 3.12 for Poetry"
id: setup-poetry-python
uses: actions/setup-python@v4
with:
python-version: 3.12

- name: "Set up dependency cache"
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ inputs.poetry-version }}-${{ hashFiles('poetry.lock') }}
key: ${{ runner.os }}-${{ steps.setup-poetry-python.outputs.python-version }}-${{ steps.setup-python.outputs.python-version }}-${{ inputs.poetry-version }}-${{ hashFiles('poetry.lock') }}
path: ${{ inputs.cache }}

- name: "Set up PATH on POSIX"
Expand All @@ -42,12 +48,13 @@ runs:
shell: bash
run: |
if ! poetry --version; then
"${{ steps.setup-python.outputs.python-path }}" -m venv "${{ inputs.cache }}/tools"
"${{ steps.setup-poetry-python.outputs.python-path }}" -m venv "${{ inputs.cache }}/tools"
pip install poetry==${{ inputs.poetry-version }}
fi
- name: "Install development dependencies"
shell: bash
run: |
poetry config cache-dir "${{ inputs.cache }}/poetry"
poetry env use "${{ steps.setup-python.outputs.python-path }}"
poetry install --sync
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ representative at an online or offline event.
## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to [Mike Cousins][].
reported to [Michael Cousins][].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down Expand Up @@ -129,4 +129,4 @@ For answers to common questions about this code of conduct, see the FAQ at
[mozilla coc]: https://github.com/mozilla/diversity
[faq]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
[mike cousins]: mailto:mike@cousins.io?subject=Decoy%20Code%20of%20Conduct
[michael cousins]: mailto:michael@cousins.io?subject=Decoy%20Code%20of%20Conduct
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2023, Mike Cousins
Copyright (c) 2020-2023, Michael Cousins

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div align="center">
<img alt="Decoy logo" src="https://mike.cousins.io/decoy/img/decoy.png" width="256px">
<img alt="Decoy logo" src="https://michael.cousins.io/decoy/img/decoy.png" width="256px">
<h1 class="decoy-title">Decoy</h1>
<p>Opinionated mocking library for Python</p>
<p>
Expand All @@ -11,7 +11,7 @@
<a title="Supported Python Versions" href="https://pypi.org/project/decoy/"><img src="https://img.shields.io/pypi/pyversions/decoy?style=flat-square"></a>
</p>
<p>
<a href="https://mike.cousins.io/decoy/" class="decoy-hidden">Usage guide and documentation</a>
<a href="https://michael.cousins.io/decoy/" class="decoy-hidden">Usage guide and documentation</a>
</p>
</div>

Expand Down Expand Up @@ -59,8 +59,8 @@ plugins = decoy.mypy

Decoy works well with [pytest][], but if you use another testing library or framework, you can still use Decoy! You just need to do two things:

1. Create a new instance of [`Decoy()`](https://mike.cousins.io/decoy/api/#decoy.Decoy) before each test
2. Call [`decoy.reset()`](https://mike.cousins.io/decoy/api/#decoy.Decoy.reset) after each test
1. Create a new instance of [`Decoy()`](https://michael.cousins.io/decoy/api/#decoy.Decoy) before each test
2. Call [`decoy.reset()`](https://michael.cousins.io/decoy/api/#decoy.Decoy.reset) after each test

For example, using the built-in [unittest][] framework, you would use the `setUp` fixture method to do `self.decoy = Decoy()` and the `tearDown` method to call `self.decoy.reset()`. For a working example, see [`tests/test_unittest.py`](https://github.com/mcous/decoy/blob/main/tests/test_unittest.py).

Expand Down Expand Up @@ -144,8 +144,8 @@ See [spying with verify][] for more details.
[unittest]: https://docs.python.org/3/library/unittest.html
[typing]: https://docs.python.org/3/library/typing.html
[mypy]: https://mypy.readthedocs.io/
[api reference]: https://mike.cousins.io/decoy/api/
[usage guide]: https://mike.cousins.io/decoy/usage/create/
[creating mocks]: https://mike.cousins.io/decoy/usage/create/
[stubbing with when]: https://mike.cousins.io/decoy/usage/when/
[spying with verify]: https://mike.cousins.io/decoy/usage/verify/
[api reference]: https://michael.cousins.io/decoy/api/
[usage guide]: https://michael.cousins.io/decoy/usage/create/
[creating mocks]: https://michael.cousins.io/decoy/usage/create/
[stubbing with when]: https://michael.cousins.io/decoy/usage/when/
[spying with verify]: https://michael.cousins.io/decoy/usage/verify/
2 changes: 1 addition & 1 deletion decoy/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, rehearsal: VerifyRehearsal) -> None:
"The same rehearsal was used in both a `when` and a `verify`.",
"This is redundant and probably a misuse of the mock.",
f"\t{stringify_call(rehearsal)}",
"See https://mike.cousins.io/decoy/usage/errors-and-warnings/#redundantverifywarning",
"See https://michael.cousins.io/decoy/usage/errors-and-warnings/#redundantverifywarning",
]
)
super().__init__(message)
Expand Down
24 changes: 12 additions & 12 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
site_name: Decoy
site_description: 'Opinionated mocking library for Python.'
site_author: 'Mike Cousins'
site_url: 'https://mike.cousins.io/decoy/'
repo_url: 'https://github.com/mcous/decoy'
repo_name: 'mcous/decoy'
edit_uri: ''
site_description: "Opinionated mocking library for Python."
site_author: "Michael Cousins"
site_url: "https://michael.cousins.io/decoy/"
repo_url: "https://github.com/mcous/decoy"
repo_name: "mcous/decoy"
edit_uri: ""

nav:
- Getting Started: index.md
Expand All @@ -22,24 +22,24 @@ nav:
- license.md

theme:
name: 'material'
name: "material"
favicon: img/favicon.ico
icon:
logo: material/duck
features:
- navigation.instant
- navigation.sections
font: 'Open Sans'
code: 'Fira Mono'
font: "Open Sans"
code: "Fira Mono"
palette:
- media: '(prefers-color-scheme: light)'
- media: "(prefers-color-scheme: light)"
scheme: default
primary: black
accent: indigo
toggle:
icon: material/weather-sunny
name: Switch to dark mode
- media: '(prefers-color-scheme: dark)'
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: amber
accent: yellow
Expand All @@ -63,7 +63,7 @@ watch:

markdown_extensions:
- toc:
permalink: '#'
permalink: "#"
- admonition
- pymdownx.highlight
- pymdownx.superfences
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
name = "decoy"
version = "2.1.0"
description = "Opinionated mocking library for Python"
authors = ["Mike Cousins <mike@cousins.io>"]
authors = ["Michael Cousins <michael@cousins.io>"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/mcous/decoy"
homepage = "https://mike.cousins.io/decoy/"
documentation = "https://mike.cousins.io/decoy/"
homepage = "https://michael.cousins.io/decoy/"
documentation = "https://michael.cousins.io/decoy/"

classifiers = [
"Development Status :: 5 - Production/Stable",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class WarningSpec(NamedTuple):
"The same rehearsal was used in both a `when` and a `verify`.",
"This is redundant and probably a misuse of the mock.",
"\tspy(1)",
"See https://mike.cousins.io/decoy/usage/errors-and-warnings/#redundantverifywarning",
"See https://michael.cousins.io/decoy/usage/errors-and-warnings/#redundantverifywarning",
]
),
),
Expand Down

0 comments on commit 781397a

Please sign in to comment.