quality-graph-python 0.1.10__py3-none-any.whl → 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
qg_python/flaky.py CHANGED
@@ -26,18 +26,32 @@ async def run_test(command: list[str]) -> ProcessResult:
26
26
 
27
27
 
28
28
  def changed_test_files(base: str) -> tuple[str, ...]:
29
- """Return changed existing Python test files in deterministic order."""
29
+ """Return runnable test files or affected fixture scopes in stable order."""
30
+ selected = {
31
+ scope
32
+ for name in added_lines_by_path(patch_for_base(base))
33
+ for path in (Path(name),)
34
+ if path.is_file() and path.suffix == ".py"
35
+ for scope in (_test_scope(path),)
36
+ if scope is not None
37
+ }
30
38
  return tuple(
31
- sorted(
32
- path
33
- for path in added_lines_by_path(patch_for_base(base))
34
- if Path(path).is_file()
35
- and Path(path).suffix == ".py"
36
- and (Path(path).name.startswith("test_") or "/tests/" in f"/{path}")
37
- )
39
+ str(path)
40
+ for path in sorted(selected)
41
+ if not any(parent in selected for parent in path.parents)
38
42
  )
39
43
 
40
44
 
45
+ def _test_scope(path: Path) -> Path | None:
46
+ if path.name == "conftest.py":
47
+ return path.parent
48
+ if path.name.startswith("test_") or path.name.endswith("_test.py"):
49
+ return path
50
+ if "tests" in path.parts:
51
+ return path.parent
52
+ return None
53
+
54
+
41
55
  def repeat(files: tuple[str, ...], attempts: int) -> int:
42
56
  """Run changed test files repeatedly with retries disabled."""
43
57
  results = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quality-graph-python
3
- Version: 0.1.10
3
+ Version: 0.2.1
4
4
  Summary: Reusable Python quality gates for Quality Graph
5
5
  Project-URL: Homepage, https://quality-graph.xyz/
6
6
  Project-URL: Documentation, https://quality-graph.xyz/
@@ -1,6 +1,6 @@
1
1
  qg_python/__init__.py,sha256=Iu124eR7Rnbwe4288dacUDh9QVBgQRJ8nIgZgj_y48I,55
2
2
  qg_python/diff.py,sha256=vcS5gXms_yfYUW0AuOVeovXencs0rWWSFlpKZlQhtQk,3371
3
- qg_python/flaky.py,sha256=onX7fvUtLmgqVbHEMb2gIK-9X89kbZPtcjYOcZI525I,2150
3
+ qg_python/flaky.py,sha256=s_kad62fR9AESjY7LDw-CLEz084OBmOE1BzNlCVroAw,2535
4
4
  qg_python/no_comments.py,sha256=sFl60AGeHZvpKdNohb0kkwlzvyZvCaPVjWeb-VPpGN4,2318
5
5
  qg_python/object_annotations.py,sha256=nhgI0KJGkZtTSMzQneNdk2pesJjIoh27Uk023QezuFw,3078
6
6
  qg_python/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
@@ -8,7 +8,7 @@ qg_python/report.py,sha256=t5zIYuCxy-WPgtNHXETKDLHTkzqkEw8jUFiGaYOwSEs,763
8
8
  qg_python/suppressions.py,sha256=i9HL8-OsU_cS1mTZTw19Y90uttmWWwLkVa1MEEeJf3E,1753
9
9
  qg_python/time_bombs.py,sha256=rwiACRITy4w8cRnD1W6lY7w0plExF8hXJCA-EXZs-Gg,2011
10
10
  qg_python/triple_quotes.py,sha256=aLWGlIsOjXNeLxDsRjJz3ifedY8tamGot9ywsXZa4Pg,5281
11
- quality_graph_python-0.1.10.dist-info/METADATA,sha256=4E_izwqpP926tsinMYlLelRm3ziX2l79o_qxtAfSZP8,3382
12
- quality_graph_python-0.1.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
- quality_graph_python-0.1.10.dist-info/entry_points.txt,sha256=1n7ymDB-MgzrAF8Rw0hnB2VClnA8mfLjT-BMAAboW-s,330
14
- quality_graph_python-0.1.10.dist-info/RECORD,,
11
+ quality_graph_python-0.2.1.dist-info/METADATA,sha256=ZGdDw4emTi2HwmJrbRyxbuVwpYlVQKwMrs8d5AitksE,3381
12
+ quality_graph_python-0.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ quality_graph_python-0.2.1.dist-info/entry_points.txt,sha256=1n7ymDB-MgzrAF8Rw0hnB2VClnA8mfLjT-BMAAboW-s,330
14
+ quality_graph_python-0.2.1.dist-info/RECORD,,