diff --git a/.github/workflows/ci.yml b/.github/workflows/tests.yml similarity index 68% rename from .github/workflows/ci.yml rename to .github/workflows/tests.yml index af2de12..3a17b76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: ci +name: tests on: push: @@ -12,7 +12,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: pre-commit/action@v3.0.0 build: @@ -21,12 +21,12 @@ jobs: strategy: matrix: platform: [ubuntu-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.11"] include: - platform: macos-latest - python-version: "3.10" + python-version: "3.11" - platform: windows-latest - python-version: "3.10" + python-version: "3.11" runs-on: ${{ matrix.platform }} @@ -34,10 +34,10 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Test with tox run: | pip install tox tox -- --cov pytest_codeblocks --cov-report xml --cov-report term - - uses: codecov/codecov-action@v3 - if: ${{ matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' }} + - uses: codecov/codecov-action@v4-beta + if: ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a1e83ea..d22aab6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,21 +1,16 @@ repos: - - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.290 hooks: - - id: isort + - id: ruff - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 23.9.1 hooks: - id: black language_version: python3 - - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 - hooks: - - id: flake8 - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.6.2 + rev: v3.0.3 hooks: - id: prettier diff --git a/LICENSE.txt b/LICENSE.txt index 8bbe8f2..34be0c4 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020-2022 Nico Schlömer +Copyright (c) 2020-present Nico Schlömer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index be6c0c9..653c3e2 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,6 @@ [![gh-actions](https://img.shields.io/github/workflow/status/nschloe/pytest-codeblocks/ci?style=flat-square)](https://github.com/nschloe/pytest-codeblocks/actions?query=workflow%3Aci) [![codecov](https://img.shields.io/codecov/c/github/nschloe/pytest-codeblocks.svg?style=flat-square)](https://app.codecov.io/gh/nschloe/pytest-codeblocks) -[![LGTM](https://img.shields.io/lgtm/grade/python/github/nschloe/pytest-codeblocks.svg?style=flat-square)](https://lgtm.com/projects/g/nschloe/pytest-codeblocks) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black) This is pytest-codeblocks, a [pytest](https://pytest.org/) plugin for testing code diff --git a/justfile b/justfile index d444cc8..698f532 100644 --- a/justfile +++ b/justfile @@ -13,10 +13,9 @@ clean: @rm -rf src/*.egg-info/ build/ dist/ .tox/ format: - isort . - black . + ruff src/ tests/ --fix + black src/ tests/ blacken-docs README.md lint: - black --check . - flake8 . + pre-commit run --all diff --git a/pyproject.toml b/pyproject.toml index 78f4059..372149e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,8 @@ classifiers = [ "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", ] dynamic = ["version"] requires-python = ">=3.7" diff --git a/src/pytest_codeblocks/main.py b/src/pytest_codeblocks/main.py index f0c46e6..742acaf 100644 --- a/src/pytest_codeblocks/main.py +++ b/src/pytest_codeblocks/main.py @@ -73,9 +73,11 @@ def extract_from_buffer(f, max_num_lines: int = 10000) -> list[CodeBlock]: elif keyword == "cont": if len(out) == 0: - raise RuntimeError( - "Found but no previous code block." + msg = ( + "Found " + "but no previous code block." ) + raise RuntimeError(msg) continued_block = out[-1] elif keyword == "skip": diff --git a/src/pytest_codeblocks/plugin.py b/src/pytest_codeblocks/plugin.py index ab1f661..c26c569 100644 --- a/src/pytest_codeblocks/plugin.py +++ b/src/pytest_codeblocks/plugin.py @@ -13,7 +13,9 @@ def pytest_addoption(parser): group = parser.getgroup("general") group.addoption( - "--codeblocks", action="store_true", help="enable testing of codeblocks" + "--codeblocks", + action="store_true", + help="enable testing of code blocks", ) @@ -46,7 +48,7 @@ def collect(self): # pytest.mark.skipif(sys.version_info < (3, 10), reason="...") # # which needs sys. Import it here. - import sys + import sys # noqa: F401 out.add_marker(eval(mark))