Skip to content

Commit 44e64cb

Browse files
committed
HH-228065 make almatest annotations pyhton3.8 compatible
1 parent 94caeec commit 44e64cb

File tree

5 files changed

+58
-26
lines changed

5 files changed

+58
-26
lines changed

almatest/almatest/check_ruff.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from __future__ import annotations
2+
import subprocess
3+
4+
5+
def check_ruff(root: str, paths: list[str]):
6+
subprocess.run(["ruff"] + paths, cwd=root).check_returncode()
7+
subprocess.run(["ruff", "format", "--check"] + paths, cwd=root).check_returncode()

almatest/poetry.lock

Lines changed: 33 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

almatest/pyproject.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ packages = [
1515
[tool.poetry.dependencies]
1616
python = ">=3.8,<=3.12"
1717
pytest = ">= 7.2.0"
18-
pytest-asyncio = ">= 0.20.1"
18+
pytest-asyncio = ">= 0.20.1,< 0.23"
1919
testcontainers = { version = ">= 4.4.0", python = ">=3.9,<=3.12" }
2020
psycopg2-binary = ">= 2.9.5"
2121
redis = "*"
2222
SQLAlchemy = {extras = ["asyncio"], version = "*"}
2323

24+
[tool.poetry.group.test.dependencies]
25+
ruff = '0.1.8'
26+
2427
[tool.poetry.plugins."pytest11"]
2528
almatest = "almatest"
2629

@@ -32,7 +35,10 @@ addopts = '''
3235
-p no:warnings
3336
'''
3437

35-
[tool.black]
38+
[tool.ruff]
3639
line-length = 120
37-
target-version = ['py39']
38-
include = '\.pyi?$'
40+
target-version = 'py38'
41+
select = [
42+
'FA',
43+
]
44+
preview = true

almatest/tests/test_codestyle.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from almatest.check_ruff import check_ruff
2+
3+
4+
def test_ruff(request) -> None:
5+
check_ruff(root=request.config.rootpath, paths=["almatest", "tests"])

ararat/tests/test_codestyle.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
import os
2-
import pathlib
3-
import subprocess
1+
from almatest.check_ruff import check_ruff
42

53

6-
ROOT = str(pathlib.Path(os.path.dirname(__file__)).parent)
7-
8-
9-
def test_ruff() -> None:
10-
subprocess.run(
11-
["ruff", "./ararat", "./tests"],
12-
cwd=ROOT,
13-
).check_returncode()
14-
subprocess.run(
15-
["ruff", "format", "--check", "./ararat", "./tests"],
16-
cwd=ROOT,
17-
).check_returncode()
4+
def test_ruff(request) -> None:
5+
check_ruff(root=request.config.rootpath, paths=["ararat", "tests"])

0 commit comments

Comments
 (0)