cordis-verify 0.2.0__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.
- cordis/__init__.py +2 -0
- cordis/_shims/pytest.py +94 -0
- cordis/ai_repo_audit.py +769 -0
- cordis/ast_gate.py +295 -0
- cordis/benchmark_suite.py +470 -0
- cordis/cli.py +503 -0
- cordis/demo_fixtures.py +58 -0
- cordis/forge_guard.py +219 -0
- cordis/fuzzer.py +450 -0
- cordis/git_diff.py +304 -0
- cordis/html_report.py +530 -0
- cordis/memory.py +189 -0
- cordis/mutator.py +636 -0
- cordis/real_repo_benchmark.py +557 -0
- cordis/wild_audit.py +297 -0
- cordis_verify-0.2.0.dist-info/METADATA +521 -0
- cordis_verify-0.2.0.dist-info/RECORD +21 -0
- cordis_verify-0.2.0.dist-info/WHEEL +5 -0
- cordis_verify-0.2.0.dist-info/entry_points.txt +3 -0
- cordis_verify-0.2.0.dist-info/licenses/LICENSE +21 -0
- cordis_verify-0.2.0.dist-info/top_level.txt +1 -0
cordis/__init__.py
ADDED
cordis/_shims/pytest.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Zero-dependency Pytest compatibility shim for pure-stdlib Cordis execution.
|
|
2
|
+
Allows real-world repositories with `import pytest` to run tests via standard library unittest.
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
_cordis_shim = True
|
|
7
|
+
|
|
8
|
+
import sys
|
|
9
|
+
import unittest
|
|
10
|
+
from contextlib import contextmanager
|
|
11
|
+
from typing import Any, Callable
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class _Mark:
|
|
15
|
+
def parametrize(self, argnames: Any, argvalues: Any, **kwargs: Any) -> Callable:
|
|
16
|
+
def decorator(fn: Callable) -> Callable:
|
|
17
|
+
fn._cordis_parametrized = (argnames, argvalues)
|
|
18
|
+
return fn
|
|
19
|
+
return decorator
|
|
20
|
+
|
|
21
|
+
def skip(self, reason: str = "") -> Callable:
|
|
22
|
+
def decorator(fn: Callable) -> Callable:
|
|
23
|
+
return unittest.skip(reason)(fn)
|
|
24
|
+
return decorator
|
|
25
|
+
|
|
26
|
+
def xfail(self, *args: Any, **kwargs: Any) -> Callable:
|
|
27
|
+
def decorator(fn: Callable) -> Callable:
|
|
28
|
+
return fn
|
|
29
|
+
return decorator
|
|
30
|
+
|
|
31
|
+
def __getattr__(self, name: str) -> Callable:
|
|
32
|
+
def decorator(fn: Callable) -> Callable:
|
|
33
|
+
return fn
|
|
34
|
+
return decorator
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
mark = _Mark()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@contextmanager
|
|
41
|
+
def raises(expected_exception: Any, match: str | None = None):
|
|
42
|
+
try:
|
|
43
|
+
yield
|
|
44
|
+
except expected_exception as exc:
|
|
45
|
+
if match:
|
|
46
|
+
import re
|
|
47
|
+
assert re.search(match, str(exc)), f"Pattern {match!r} not in {str(exc)!r}"
|
|
48
|
+
return
|
|
49
|
+
except Exception as e:
|
|
50
|
+
raise AssertionError(f"Expected {expected_exception.__name__}, got {type(e).__name__}: {e}")
|
|
51
|
+
raise AssertionError(f"DID NOT RAISE {expected_exception.__name__}")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@contextmanager
|
|
55
|
+
def warns(expected_warning: Any = None, match: str | None = None):
|
|
56
|
+
yield
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@contextmanager
|
|
60
|
+
def deprecated_call():
|
|
61
|
+
yield
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def approx(val: Any, rel: float | None = None, abs: float | None = None) -> Any:
|
|
65
|
+
return val
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def skip(msg: str = "") -> None:
|
|
69
|
+
raise unittest.SkipTest(msg)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def fail(msg: str = "") -> None:
|
|
73
|
+
raise AssertionError(msg)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def fixture(*args: Any, **kwargs: Any) -> Callable:
|
|
77
|
+
def decorator(fn: Callable) -> Callable:
|
|
78
|
+
return fn
|
|
79
|
+
if args and callable(args[0]):
|
|
80
|
+
return args[0]
|
|
81
|
+
return decorator
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class MonkeyPatch:
|
|
85
|
+
def setattr(self, target: Any, name: str, value: Any, raising: bool = True) -> None:
|
|
86
|
+
setattr(target, name, value)
|
|
87
|
+
|
|
88
|
+
def setenv(self, name: str, value: str) -> None:
|
|
89
|
+
import os
|
|
90
|
+
os.environ[name] = value
|
|
91
|
+
|
|
92
|
+
def delenv(self, name: str, raising: bool = True) -> None:
|
|
93
|
+
import os
|
|
94
|
+
os.environ.pop(name, None)
|