pintest-cli 0.2.1__tar.gz → 0.2.3__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.
Files changed (26) hide show
  1. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/PKG-INFO +1 -1
  2. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/cli.py +28 -3
  3. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/config.py +3 -0
  4. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/pre_commit_hook.py +6 -2
  5. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest_cli.egg-info/PKG-INFO +1 -1
  6. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/setup.py +1 -1
  7. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/README.md +0 -0
  8. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/__init__.py +0 -0
  9. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/build_mapping_iterative.py +0 -0
  10. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/cloud_mapping_db.py +0 -0
  11. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/coverage_mapper.py +0 -0
  12. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/git_diff_parser.py +0 -0
  13. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/post_commit_hook.py +0 -0
  14. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/range_set.py +0 -0
  15. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/test_mapping_db_v2.py +0 -0
  16. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest/update_mapping.py +0 -0
  17. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest_cli.egg-info/SOURCES.txt +0 -0
  18. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest_cli.egg-info/dependency_links.txt +0 -0
  19. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest_cli.egg-info/entry_points.txt +0 -0
  20. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest_cli.egg-info/requires.txt +0 -0
  21. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/pintest_cli.egg-info/top_level.txt +0 -0
  22. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/setup.cfg +0 -0
  23. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/tests/__init__.py +0 -0
  24. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/tests/test_git_diff_parser.py +0 -0
  25. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/tests/test_new_feature.py +0 -0
  26. {pintest_cli-0.2.1 → pintest_cli-0.2.3}/tests/test_range_set.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pintest-cli
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Run only the tests affected by your code changes.
5
5
  Author: Pintest Contributors
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -274,9 +274,20 @@ def cmd_build_mapping(args):
274
274
  repo_root = args.repo_root.resolve()
275
275
  mapping_db = args.mapping_db or (repo_root / ".test_mapping.db")
276
276
 
277
+ # Load config to get default test_dir if it was saved during track
278
+ from .config import Config
279
+ cfg = Config.load()
280
+ default_test_dir = "tests"
281
+ if cfg.is_cloud_enabled and getattr(cfg.cloud, "test_dir", None):
282
+ default_test_dir = cfg.cloud.test_dir
283
+
284
+ # Use args.test_dir if explicitly provided and not the default "tests", otherwise use config
285
+ final_test_dir = args.test_dir if args.test_dir != "tests" else default_test_dir
286
+
277
287
  sys.exit(build_mapping_iteratively(
278
288
  repo_root,
279
289
  mapping_db,
290
+ test_dir=final_test_dir,
280
291
  verbose=args.verbose
281
292
  ))
282
293
 
@@ -391,6 +402,14 @@ def cmd_track(args):
391
402
  except (KeyboardInterrupt, EOFError):
392
403
  print("\n❌ Cancelled")
393
404
  sys.exit(1)
405
+
406
+ try:
407
+ test_dir = input("📁 Test directory [tests]: ").strip()
408
+ if not test_dir:
409
+ test_dir = "tests"
410
+ except (KeyboardInterrupt, EOFError):
411
+ print("\n❌ Cancelled")
412
+ sys.exit(1)
394
413
 
395
414
  cfg = Config.load()
396
415
  if not cfg.is_cloud_enabled:
@@ -437,12 +456,13 @@ def cmd_track(args):
437
456
  repo = resp.json()
438
457
  repo_id = repo["id"]
439
458
 
440
- # Save repo_id and branch to config
459
+ # Save repo_id, branch, and test_dir to config
441
460
  cfg.cloud.repo_id = repo_id
442
461
  cfg.cloud.branch = branch
462
+ cfg.cloud.test_dir = test_dir
443
463
  cfg.save()
444
-
445
- print(f"\n✅ Repository registered!")
464
+
465
+ print(f"✅ Success! Repository mapped to {branch} branch")
446
466
  print(f" Name: {repo['name']}")
447
467
  print(f" ID: {repo_id}")
448
468
  print(f" Branch: {branch}")
@@ -597,6 +617,11 @@ Examples:
597
617
  type=Path,
598
618
  help="Path to mapping database (default: <repo>/.test_mapping.db)"
599
619
  )
620
+ build_parser.add_argument(
621
+ "--test-dir",
622
+ default="tests",
623
+ help="Directory containing tests (default: tests)"
624
+ )
600
625
  build_parser.add_argument(
601
626
  "-v", "--verbose",
602
627
  action="store_true",
@@ -25,6 +25,7 @@ class CloudConfig:
25
25
  api_url: str = "https://api.pintest.dev"
26
26
  repo_id: Optional[str] = None
27
27
  branch: str = "main"
28
+ test_dir: str = "tests"
28
29
 
29
30
 
30
31
  @dataclass
@@ -51,6 +52,7 @@ class Config:
51
52
  api_url=cloud_data.get("api_url", "https://api.pintest.dev"),
52
53
  repo_id=cloud_data.get("repo_id"),
53
54
  branch=cloud_data.get("branch", "main"),
55
+ test_dir=cloud_data.get("test_dir", "tests"),
54
56
  )
55
57
  else:
56
58
  cloud = None
@@ -70,6 +72,7 @@ class Config:
70
72
  if self.cloud.repo_id:
71
73
  lines.append(f'repo_id = "{self.cloud.repo_id}"')
72
74
  lines.append(f'branch = "{self.cloud.branch}"')
75
+ lines.append(f'test_dir = "{self.cloud.test_dir}"')
73
76
  lines.append("")
74
77
 
75
78
  CONFIG_FILE.write_text("\n".join(lines))
@@ -417,8 +417,12 @@ def collect_all_tests(repo_root: Path, test_dir: str = None, verbose: bool = Fal
417
417
  return test_names
418
418
 
419
419
  except subprocess.CalledProcessError as e:
420
- if verbose:
421
- print(f"Warning: Could not collect tests: {e.stderr}", file=sys.stderr)
420
+ print(f"\n❌ Pytest failed to collect tests!", file=sys.stderr)
421
+ print(f"This usually means your project dependencies aren't installed.", file=sys.stderr)
422
+ if e.stderr:
423
+ print(f"\nPytest Error Output:\n{e.stderr}", file=sys.stderr)
424
+ elif e.stdout:
425
+ print(f"\nPytest Output:\n{e.stdout}", file=sys.stderr)
422
426
  return set()
423
427
 
424
428
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pintest-cli
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Run only the tests affected by your code changes.
5
5
  Author: Pintest Contributors
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -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.1",
8
+ version="0.2.3",
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