Skip to content

Commit f58c700

Browse files
authored
Merge pull request #96 from nschloe/ruff
use ruff
2 parents 27c3cc9 + e7084c5 commit f58c700

File tree

8 files changed

+27
-28
lines changed

8 files changed

+27
-28
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ci
1+
name: tests
22

33
on:
44
push:
@@ -12,7 +12,7 @@ jobs:
1212
lint:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
- uses: pre-commit/[email protected]
1717

1818
build:
@@ -21,23 +21,23 @@ jobs:
2121
strategy:
2222
matrix:
2323
platform: [ubuntu-latest]
24-
python-version: ["3.7", "3.8", "3.9", "3.10"]
24+
python-version: ["3.7", "3.11"]
2525
include:
2626
- platform: macos-latest
27-
python-version: "3.10"
27+
python-version: "3.11"
2828
- platform: windows-latest
29-
python-version: "3.10"
29+
python-version: "3.11"
3030

3131
runs-on: ${{ matrix.platform }}
3232

3333
steps:
3434
- uses: actions/setup-python@v4
3535
with:
3636
python-version: ${{ matrix.python-version }}
37-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v4
3838
- name: Test with tox
3939
run: |
4040
pip install tox
4141
tox -- --cov pytest_codeblocks --cov-report xml --cov-report term
42-
- uses: codecov/codecov-action@v3
43-
if: ${{ matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' }}
42+
- uses: codecov/codecov-action@v4-beta
43+
if: ${{ matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest' }}

.pre-commit-config.yaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
repos:
2-
- repo: https://github.com/PyCQA/isort
3-
rev: 5.10.1
2+
- repo: https://github.com/charliermarsh/ruff-pre-commit
3+
rev: v0.0.290
44
hooks:
5-
- id: isort
5+
- id: ruff
66

77
- repo: https://github.com/psf/black
8-
rev: 22.3.0
8+
rev: 23.9.1
99
hooks:
1010
- id: black
1111
language_version: python3
1212

13-
- repo: https://github.com/PyCQA/flake8
14-
rev: 4.0.1
15-
hooks:
16-
- id: flake8
17-
1813
- repo: https://github.com/pre-commit/mirrors-prettier
19-
rev: v2.6.2
14+
rev: v3.0.3
2015
hooks:
2116
- id: prettier

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2020-2022 Nico Schlömer
3+
Copyright (c) 2020-present Nico Schlömer
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
[![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)
1515
[![codecov](https://img.shields.io/codecov/c/github/nschloe/pytest-codeblocks.svg?style=flat-square)](https://app.codecov.io/gh/nschloe/pytest-codeblocks)
16-
[![LGTM](https://img.shields.io/lgtm/grade/python/github/nschloe/pytest-codeblocks.svg?style=flat-square)](https://lgtm.com/projects/g/nschloe/pytest-codeblocks)
1716
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)
1817

1918
This is pytest-codeblocks, a [pytest](https://pytest.org/) plugin for testing code

justfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ clean:
1313
@rm -rf src/*.egg-info/ build/ dist/ .tox/
1414

1515
format:
16-
isort .
17-
black .
16+
ruff src/ tests/ --fix
17+
black src/ tests/
1818
blacken-docs README.md
1919

2020
lint:
21-
black --check .
22-
flake8 .
21+
pre-commit run --all

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ classifiers = [
2323
"Programming Language :: Python :: 3.8",
2424
"Programming Language :: Python :: 3.9",
2525
"Programming Language :: Python :: 3.10",
26+
"Programming Language :: Python :: 3.11",
27+
"Programming Language :: Python :: 3.12",
2628
]
2729
dynamic = ["version"]
2830
requires-python = ">=3.7"

src/pytest_codeblocks/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ def extract_from_buffer(f, max_num_lines: int = 10000) -> list[CodeBlock]:
7373

7474
elif keyword == "cont":
7575
if len(out) == 0:
76-
raise RuntimeError(
77-
"Found <!--pytest-codeblocks-cont--> but no previous code block."
76+
msg = (
77+
"Found <!--pytest-codeblocks-cont--> "
78+
"but no previous code block."
7879
)
80+
raise RuntimeError(msg)
7981
continued_block = out[-1]
8082

8183
elif keyword == "skip":

src/pytest_codeblocks/plugin.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
def pytest_addoption(parser):
1414
group = parser.getgroup("general")
1515
group.addoption(
16-
"--codeblocks", action="store_true", help="enable testing of codeblocks"
16+
"--codeblocks",
17+
action="store_true",
18+
help="enable testing of code blocks",
1719
)
1820

1921

@@ -46,7 +48,7 @@ def collect(self):
4648
# pytest.mark.skipif(sys.version_info < (3, 10), reason="...")
4749
#
4850
# which needs sys. Import it here.
49-
import sys
51+
import sys # noqa: F401
5052

5153
out.add_marker(eval(mark))
5254

0 commit comments

Comments
 (0)