pintest-cli 0.2.7__tar.gz → 0.2.8__tar.gz
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.
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/PKG-INFO +1 -1
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/build_mapping_iterative.py +14 -2
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/cli.py +21 -4
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/cloud_mapping_db.py +19 -2
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/pre_commit_hook.py +12 -4
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/pytest_plugin.py +3 -1
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/update_mapping.py +11 -2
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest_cli.egg-info/PKG-INFO +1 -1
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/setup.py +1 -1
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/README.md +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/__init__.py +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/config.py +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/coverage_mapper.py +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/git_diff_parser.py +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/post_commit_hook.py +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/push_cache.py +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/range_set.py +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest/test_mapping_db_v2.py +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest_cli.egg-info/SOURCES.txt +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest_cli.egg-info/dependency_links.txt +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest_cli.egg-info/entry_points.txt +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest_cli.egg-info/requires.txt +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/pintest_cli.egg-info/top_level.txt +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/setup.cfg +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/tests/__init__.py +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/tests/test_git_diff_parser.py +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/tests/test_new_feature.py +0 -0
- {pintest_cli-0.2.7 → pintest_cli-0.2.8}/tests/test_range_set.py +0 -0
|
@@ -299,7 +299,7 @@ def main():
|
|
|
299
299
|
parser.add_argument(
|
|
300
300
|
"--mapping-db",
|
|
301
301
|
type=Path,
|
|
302
|
-
help="Path to mapping database (default: <repo>/.test_mapping.db)"
|
|
302
|
+
help="Path to mapping database (default: <repo>/.pintest/test_mapping.db)"
|
|
303
303
|
)
|
|
304
304
|
parser.add_argument(
|
|
305
305
|
"--test-dir",
|
|
@@ -316,7 +316,19 @@ def main():
|
|
|
316
316
|
args = parser.parse_args()
|
|
317
317
|
|
|
318
318
|
repo_root = args.repo_root.resolve()
|
|
319
|
-
|
|
319
|
+
if args.mapping_db:
|
|
320
|
+
mapping_db = args.mapping_db
|
|
321
|
+
else:
|
|
322
|
+
mapping_db = repo_root / ".pintest" / "test_mapping.db"
|
|
323
|
+
legacy_db = repo_root / ".test_mapping.db"
|
|
324
|
+
if not mapping_db.exists() and legacy_db.exists():
|
|
325
|
+
mapping_db.parent.mkdir(parents=True, exist_ok=True)
|
|
326
|
+
try:
|
|
327
|
+
legacy_db.rename(mapping_db)
|
|
328
|
+
except Exception:
|
|
329
|
+
mapping_db = legacy_db
|
|
330
|
+
else:
|
|
331
|
+
mapping_db.parent.mkdir(parents=True, exist_ok=True)
|
|
320
332
|
|
|
321
333
|
return build_mapping_iteratively(
|
|
322
334
|
repo_root,
|
|
@@ -188,7 +188,14 @@ def cmd_run(args):
|
|
|
188
188
|
# 2. Try Local V2 Mapping DB
|
|
189
189
|
mapping_db = args.mapping_db if hasattr(args, 'mapping_db') else None
|
|
190
190
|
if not mapping_db:
|
|
191
|
-
mapping_db = repo_root / ".test_mapping.db"
|
|
191
|
+
mapping_db = repo_root / ".pintest" / "test_mapping.db"
|
|
192
|
+
legacy_db = repo_root / ".test_mapping.db"
|
|
193
|
+
if not mapping_db.exists() and legacy_db.exists():
|
|
194
|
+
mapping_db.parent.mkdir(parents=True, exist_ok=True)
|
|
195
|
+
try:
|
|
196
|
+
legacy_db.rename(mapping_db)
|
|
197
|
+
except Exception:
|
|
198
|
+
mapping_db = legacy_db
|
|
192
199
|
|
|
193
200
|
if not mapping_db.exists():
|
|
194
201
|
print("🏗️ No local mapping DB found. Initializing build...", file=sys.stderr)
|
|
@@ -303,7 +310,17 @@ def cmd_build_mapping(args):
|
|
|
303
310
|
from .build_mapping_iterative import build_mapping_iteratively
|
|
304
311
|
|
|
305
312
|
repo_root = args.repo_root.resolve()
|
|
306
|
-
|
|
313
|
+
if args.mapping_db:
|
|
314
|
+
mapping_db = args.mapping_db
|
|
315
|
+
else:
|
|
316
|
+
mapping_db = repo_root / ".pintest" / "test_mapping.db"
|
|
317
|
+
legacy_db = repo_root / ".test_mapping.db"
|
|
318
|
+
if not mapping_db.exists() and legacy_db.exists():
|
|
319
|
+
mapping_db.parent.mkdir(parents=True, exist_ok=True)
|
|
320
|
+
try:
|
|
321
|
+
legacy_db.rename(mapping_db)
|
|
322
|
+
except Exception:
|
|
323
|
+
mapping_db = legacy_db
|
|
307
324
|
|
|
308
325
|
# Load config to get default test_dir if it was saved during track
|
|
309
326
|
from .config import Config
|
|
@@ -618,7 +635,7 @@ Examples:
|
|
|
618
635
|
update_parser.add_argument(
|
|
619
636
|
"--mapping-db",
|
|
620
637
|
type=Path,
|
|
621
|
-
help="Path to mapping database (default: <repo>/.test_mapping.db)"
|
|
638
|
+
help="Path to mapping database (default: <repo>/.pintest/test_mapping.db)"
|
|
622
639
|
)
|
|
623
640
|
update_parser.add_argument(
|
|
624
641
|
"-v", "--verbose",
|
|
@@ -648,7 +665,7 @@ Examples:
|
|
|
648
665
|
build_parser.add_argument(
|
|
649
666
|
"--mapping-db",
|
|
650
667
|
type=Path,
|
|
651
|
-
help="Path to mapping database (default: <repo>/.test_mapping.db)"
|
|
668
|
+
help="Path to mapping database (default: <repo>/.pintest/test_mapping.db)"
|
|
652
669
|
)
|
|
653
670
|
build_parser.add_argument(
|
|
654
671
|
"--test-dir",
|
|
@@ -138,12 +138,29 @@ class CloudMappingDB:
|
|
|
138
138
|
test_file_ranges[key] = RangeSet()
|
|
139
139
|
test_file_ranges[key].add_range(line_num, line_num)
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
pintest_dir = coverage_file.parent / ".pintest"
|
|
142
|
+
pintest_dir.mkdir(parents=True, exist_ok=True)
|
|
143
|
+
|
|
144
|
+
cache_db_path = pintest_dir / "push_cache.db"
|
|
145
|
+
legacy_cache = coverage_file.parent / ".pintest_push_cache.db"
|
|
146
|
+
if not cache_db_path.exists() and legacy_cache.exists():
|
|
147
|
+
try:
|
|
148
|
+
legacy_cache.rename(cache_db_path)
|
|
149
|
+
except Exception:
|
|
150
|
+
cache_db_path = legacy_cache
|
|
151
|
+
|
|
142
152
|
push_cache = PushCache(cache_db_path)
|
|
143
153
|
cached_state = push_cache.get_cached_state(self._branch)
|
|
144
154
|
|
|
145
155
|
import json
|
|
146
|
-
durations_file =
|
|
156
|
+
durations_file = pintest_dir / "durations.json"
|
|
157
|
+
legacy_durations = coverage_file.parent / ".pintest_durations.json"
|
|
158
|
+
if not durations_file.exists() and legacy_durations.exists():
|
|
159
|
+
try:
|
|
160
|
+
legacy_durations.rename(durations_file)
|
|
161
|
+
except Exception:
|
|
162
|
+
durations_file = legacy_durations
|
|
163
|
+
|
|
147
164
|
try:
|
|
148
165
|
test_durations = json.loads(durations_file.read_text()) if durations_file.exists() else {}
|
|
149
166
|
except Exception:
|
|
@@ -71,7 +71,7 @@ def ensure_git_lfs(repo_root: Path, verbose: bool = False) -> bool:
|
|
|
71
71
|
"""
|
|
72
72
|
Ensure Git LFS is initialized in the repository.
|
|
73
73
|
|
|
74
|
-
This is needed if the repo uses Git LFS for storing large files like .test_mapping.db.
|
|
74
|
+
This is needed if the repo uses Git LFS for storing large files like .pintest/test_mapping.db.
|
|
75
75
|
Safe to run multiple times.
|
|
76
76
|
|
|
77
77
|
Args:
|
|
@@ -1079,7 +1079,7 @@ def main():
|
|
|
1079
1079
|
"--mapping-db",
|
|
1080
1080
|
type=Path,
|
|
1081
1081
|
default=None,
|
|
1082
|
-
help="Path to test mapping database (default: <repo>/.test_mapping.db)"
|
|
1082
|
+
help="Path to test mapping database (default: <repo>/.pintest/test_mapping.db)"
|
|
1083
1083
|
)
|
|
1084
1084
|
parser.add_argument(
|
|
1085
1085
|
"--test-dir",
|
|
@@ -1118,13 +1118,21 @@ def main():
|
|
|
1118
1118
|
repo_root = args.repo_root.resolve()
|
|
1119
1119
|
|
|
1120
1120
|
# Set up log file for tracking all output
|
|
1121
|
-
|
|
1121
|
+
pintest_dir = repo_root / ".pintest"
|
|
1122
|
+
pintest_dir.mkdir(parents=True, exist_ok=True)
|
|
1123
|
+
log_file = pintest_dir / "pre-commit.log"
|
|
1122
1124
|
|
|
1123
1125
|
# Use TeeOutput to write to both stdout and log file
|
|
1124
1126
|
with TeeOutput(log_file):
|
|
1125
1127
|
# Default mapping database location
|
|
1126
1128
|
if args.mapping_db is None:
|
|
1127
|
-
mapping_db =
|
|
1129
|
+
mapping_db = pintest_dir / "test_mapping.db"
|
|
1130
|
+
legacy_db = repo_root / ".test_mapping.db"
|
|
1131
|
+
if not mapping_db.exists() and legacy_db.exists():
|
|
1132
|
+
try:
|
|
1133
|
+
legacy_db.rename(mapping_db)
|
|
1134
|
+
except Exception:
|
|
1135
|
+
mapping_db = legacy_db
|
|
1128
1136
|
else:
|
|
1129
1137
|
mapping_db = args.mapping_db
|
|
1130
1138
|
|
|
@@ -16,7 +16,9 @@ def pytest_runtest_makereport(item, call):
|
|
|
16
16
|
def pytest_sessionfinish(session, exitstatus):
|
|
17
17
|
"""Dump durations to a temporary file for the CLI push phase."""
|
|
18
18
|
try:
|
|
19
|
-
|
|
19
|
+
pintest_dir = Path(session.config.rootdir) / ".pintest"
|
|
20
|
+
pintest_dir.mkdir(parents=True, exist_ok=True)
|
|
21
|
+
out_file = pintest_dir / "durations.json"
|
|
20
22
|
with open(out_file, "w") as f:
|
|
21
23
|
json.dump(test_durations, f)
|
|
22
24
|
except Exception as e:
|
|
@@ -42,7 +42,16 @@ def update_mapping(
|
|
|
42
42
|
coverage_file = repo_root / "coverage" / ".coverage"
|
|
43
43
|
|
|
44
44
|
if mapping_db is None:
|
|
45
|
-
mapping_db = repo_root / ".test_mapping.db"
|
|
45
|
+
mapping_db = repo_root / ".pintest" / "test_mapping.db"
|
|
46
|
+
legacy_db = repo_root / ".test_mapping.db"
|
|
47
|
+
if not mapping_db.exists() and legacy_db.exists():
|
|
48
|
+
mapping_db.parent.mkdir(parents=True, exist_ok=True)
|
|
49
|
+
try:
|
|
50
|
+
legacy_db.rename(mapping_db)
|
|
51
|
+
except Exception:
|
|
52
|
+
mapping_db = legacy_db
|
|
53
|
+
else:
|
|
54
|
+
mapping_db.parent.mkdir(parents=True, exist_ok=True)
|
|
46
55
|
|
|
47
56
|
if verbose:
|
|
48
57
|
pass
|
|
@@ -101,7 +110,7 @@ def main():
|
|
|
101
110
|
parser.add_argument(
|
|
102
111
|
"--mapping-db",
|
|
103
112
|
type=Path,
|
|
104
|
-
help="Path to mapping database (default: <repo>/.test_mapping.db)"
|
|
113
|
+
help="Path to mapping database (default: <repo>/.pintest/test_mapping.db)"
|
|
105
114
|
)
|
|
106
115
|
parser.add_argument(
|
|
107
116
|
"-v", "--verbose",
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
5
5
|
|
|
6
6
|
setup(
|
|
7
7
|
name="pintest-cli",
|
|
8
|
-
version="0.2.
|
|
8
|
+
version="0.2.8",
|
|
9
9
|
description="Run only the tests affected by your code changes.",
|
|
10
10
|
long_description=long_description,
|
|
11
11
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|