Skip to content

Commit

Permalink
Chore: Switch to Hatch (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
BeyondEvil committed May 27, 2023
1 parent 4194258 commit 2ca1891
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 697 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/nightly.yml

This file was deleted.

58 changes: 33 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,58 @@
name: test
name: Tests

on:
push:
branches:
- master
tags-ignore:
- v*

schedule:
- cron: '0 16 * * *' # Run daily at 14:00 UTC

pull_request:
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ ! contains(github.ref, github.event.repository.default_branch) }}

jobs:
test:
runs-on: ${{ matrix.os }}
name: ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "~3.11.0-0", "pypy-3.8"]
os: [ubuntu-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
include:
- python: "3.7"
tox_env: "py37"
- python: "3.8"
tox_env: "py38"
- python: "3.9"
tox_env: "py39"
- python: "3.10"
tox_env: "py310"
- python: "~3.11.0-0" # see https://github.com/actions/setup-python/issues/213#issuecomment-1146676713
tox_env: "py311"
- python: "pypy-3.8"
tox_env: "pypy3"
- python-version: pypy3.9
tox-env: py3.9
- python-version: 3.11-dev
tox-env: devel

steps:
- uses: actions/checkout@v3
- name: Set up Python

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
python-version: ${{ matrix.python-version }}

- name: Install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Cache tox environments
uses: actions/cache@v3
with:
path: .tox
# increment if issues with cache
key: tox-${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}-01
- name: Test
run: tox -e ${{ matrix.tox_env }}
key: tox-ubuntu-latest-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
tox-ubuntu-latest-${{ matrix.python-version }}-
- name: Run tests
if: ${{ ! matrix.tox-env }}
run: tox -e py${{ matrix.python-version }}

- name: Run tests
if: ${{ matrix.tox-env }}
run: tox -e ${{ matrix.tox-env }}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
__pycache__
__version.py
*.egg-info/
*.pyc
.cache
Expand All @@ -7,5 +8,3 @@ __pycache__

build
dist

pytest_metadata/__version.py
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Release Notes
3.0.0 (unreleased)
------------------

* Switch to Hatch

* Use `pytest.stash` internally instead of `_metadata`

* Simplify code
Expand Down
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ To add/modify/delete metadata at the end of metadata collection, you can use the
.. code-block:: python
import pytest
@pytest.mark.optionalhook
@pytest.hookimpl(optionalhook=True)
def pytest_metadata(metadata):
metadata.pop("password", None)
Expand All @@ -163,14 +163,14 @@ fixture:
def test_metadata(metadata):
assert 'metadata' in metadata['Plugins']
To access the metadata from a plugin, you can use the ``_metadata`` attribute of
To access the metadata from a plugin, you can use the ``stash`` attribute of
the ``config`` object. This can be used to read/add/modify the metadata:

.. code-block:: python
def pytest_configure(config):
if hasattr(config, '_metadata'):
config._metadata['foo'] = 'bar'
from pytest_metadata.plugin import metadata_key
config.stash[metadata_key]['foo'] = 'bar'
Plugin integrations
-------------------
Expand Down

0 comments on commit 2ca1891

Please sign in to comment.