Skip to content

Commit

Permalink
Merge pull request #10 from Secrus/various-improvements
Browse files Browse the repository at this point in the history
Various improvements
  • Loading branch information
sdispater authored Oct 31, 2022
2 parents 8435ee7 + c3e4c89 commit c9b7dfa
Show file tree
Hide file tree
Showing 7 changed files with 257 additions and 93 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
max-parallel: 4
matrix:
os: [Ubuntu, MacOS, Windows]
python-version: [3.7, 3.8, 3.9, "3.10"]
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]

defaults:
run:
Expand All @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v3

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

Expand Down Expand Up @@ -61,13 +61,20 @@ jobs:
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true' && matrix.os != 'MacOS'
run: timeout 10s poetry run pip --version || rm -rf .venv
if: steps.cache.outputs.cache-hit == 'true'
run: |
# `timeout` is not available on macOS, so we define a custom function.
[ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
# Using `timeout` is a safeguard against the Poetry command hanging for some reason.
timeout 10s poetry run pip --version || rm -rf .venv
- name: Install dependencies
shell: bash
run: poetry install

- name: Run mypy
run: poetry run mypy

- name: Run pytest
shell: bash
run: poetry run pytest -v tests
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,30 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Get tag
id: tag
run: |
echo ::set-output name=tag::${GITHUB_REF#refs/tags/}
- name: Set up Python 3.7
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Install dependencies
run: python -m pip install --upgrade pip poetry --pre
run: python -m pip install --upgrade pip poetry

- name: Build project
run: poetry build

- name: Publish release to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry build
poetry publish
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down
72 changes: 33 additions & 39 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,64 +1,58 @@
ci:
autofix_prs: false

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.38.2
hooks:
- id: pyupgrade
args:
- --py37-plus

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://github.com/hadialqattan/pycln
rev: v2.1.1
hooks:
- id: pycln
args: [--all]

- repo: https://github.com/psf/black
rev: 22.6.0
rev: 22.8.0
hooks:
- id: black

- repo: https://github.com/asottile/yesqa
rev: v1.3.0
rev: v1.4.0
hooks:
- id: yesqa
additional_dependencies: &flake8_deps
- flake8-broken-line==0.4.0
- flake8-bugbear==22.7.1
- flake8-broken-line==0.5.0
- flake8-bugbear==22.8.23
- flake8-comprehensions==3.10.0
- flake8-eradicate==1.2.1
- flake8-eradicate==1.3.0
- flake8-quotes==3.3.1
- flake8-simplify==0.19.2
- flake8-simplify==0.19.3
- flake8-tidy-imports==4.8.0
- flake8-type-checking==2.0.3
- flake8-typing-imports==1.12.0
- flake8-use-fstring==1.3
- pep8-naming==0.13.0
- flake8-type-checking==2.1.2
- flake8-typing-imports==1.13.0
- flake8-use-fstring==1.4
- pep8-naming==0.13.2

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 5.0.4
hooks:
- id: flake8
additional_dependencies: *flake8_deps

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: [--add-import, from __future__ import annotations]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v4.3.0
hooks:
- id: trailing-whitespace
exclude: ^tests/.*/fixtures/.*
- id: end-of-file-fixer
exclude: ^tests/.*/fixtures/.*
- id: debug-statements

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
hooks:
- id: mypy
pass_filenames: false
additional_dependencies:
- pytest>=7.1.2

- repo: https://github.com/asottile/pyupgrade
rev: v2.37.2
hooks:
- id: pyupgrade
args:
- --py37-plus

- repo: https://github.com/hadialqattan/pycln
rev: v2.0.4
hooks:
- id: pycln
args: [--all]
2 changes: 1 addition & 1 deletion crashtest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations


__version__ = "0.4.0"
__version__ = "0.4.1"
4 changes: 2 additions & 2 deletions crashtest/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@


class Inspector:
def __init__(self, exception: Exception):
def __init__(self, exception: BaseException):
self._exception = exception
self._frames: FrameCollection | None = None
self._outer_frames = None
self._inner_frames = None
self._previous_exception = exception.__context__

@property
def exception(self) -> Exception:
def exception(self) -> BaseException:
return self._exception

@property
Expand Down
Loading

0 comments on commit c9b7dfa

Please sign in to comment.