mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-06 13:02:55 +00:00
ruff: enable TC — flake8-type-checking (#11368)
## Problem `TYPE_CHECKING` is used inconsistently across Python tests. ## Summary of changes - Update `ruff`: 0.7.0 -> 0.11.2 - Enable TC (flake8-type-checking): https://docs.astral.sh/ruff/rules/#flake8-type-checking-tc - (auto)fix all new issues
This commit is contained in:
committed by
GitHub
parent
db5384e1b0
commit
30a7dd630c
@@ -1,18 +1,21 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import threading
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
from fixtures.compare_fixtures import PgCompare
|
||||
from fixtures.neon_fixtures import PgProtocol
|
||||
|
||||
from performance.test_perf_pgbench import get_scales_matrix
|
||||
from performance.test_wal_backpressure import record_read_latency
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from fixtures.compare_fixtures import PgCompare
|
||||
from fixtures.neon_fixtures import PgProtocol
|
||||
|
||||
|
||||
def start_write_workload(pg: PgProtocol, scale: int = 10):
|
||||
with pg.connect().cursor() as cur:
|
||||
cur.execute(f"create table big as select generate_series(1,{scale*100_000})")
|
||||
cur.execute(f"create table big as select generate_series(1,{scale * 100_000})")
|
||||
|
||||
|
||||
# Measure latency of reads on one table, while lots of writes are happening on another table.
|
||||
@@ -24,7 +27,7 @@ def test_measure_read_latency_heavy_write_workload(neon_with_baseline: PgCompare
|
||||
pg = env.pg
|
||||
|
||||
with pg.connect().cursor() as cur:
|
||||
cur.execute(f"create table small as select generate_series(1,{scale*100_000})")
|
||||
cur.execute(f"create table small as select generate_series(1,{scale * 100_000})")
|
||||
|
||||
write_thread = threading.Thread(target=start_write_workload, args=(pg, scale * 100))
|
||||
write_thread.start()
|
||||
|
||||
Reference in New Issue
Block a user