pintest-cli 0.3.3__tar.gz → 0.3.5__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 (29) hide show
  1. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/PKG-INFO +1 -1
  2. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/build_mapping_iterative.py +14 -5
  3. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/cli.py +19 -3
  4. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/pytest_plugin.py +13 -1
  5. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest_cli.egg-info/PKG-INFO +1 -1
  6. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/setup.py +1 -1
  7. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/README.md +0 -0
  8. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/__init__.py +0 -0
  9. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/cloud_mapping_db.py +0 -0
  10. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/config.py +0 -0
  11. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/coverage_mapper.py +0 -0
  12. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/git_diff_parser.py +0 -0
  13. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/post_commit_hook.py +0 -0
  14. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/pre_commit_hook.py +0 -0
  15. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/push_cache.py +0 -0
  16. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/range_set.py +0 -0
  17. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/test_mapping_db_v2.py +0 -0
  18. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest/update_mapping.py +0 -0
  19. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest_cli.egg-info/SOURCES.txt +0 -0
  20. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest_cli.egg-info/dependency_links.txt +0 -0
  21. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest_cli.egg-info/entry_points.txt +0 -0
  22. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest_cli.egg-info/requires.txt +0 -0
  23. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/pintest_cli.egg-info/top_level.txt +0 -0
  24. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/setup.cfg +0 -0
  25. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/tests/__init__.py +0 -0
  26. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/tests/test_cli_e2e.py +0 -0
  27. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/tests/test_git_diff_parser.py +0 -0
  28. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/tests/test_new_feature.py +0 -0
  29. {pintest_cli-0.3.3 → pintest_cli-0.3.5}/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.3.3
3
+ Version: 0.3.5
4
4
  Summary: Run only the tests affected by your code changes.
5
5
  Author: Pintest Contributors
6
6
  Classifier: Development Status :: 3 - Alpha
@@ -35,7 +35,8 @@ def run_test_chunk_with_mapping(
35
35
  repo_root: Path,
36
36
  test_names: list,
37
37
  mapping_db_path: Path,
38
- verbose: bool = False
38
+ verbose: bool = False,
39
+ pytest_args: list = None
39
40
  ) -> tuple[Set[str], Set[str]]:
40
41
  """
41
42
  Run a chunk of tests with coverage and update mapping.
@@ -45,6 +46,7 @@ def run_test_chunk_with_mapping(
45
46
  test_names: List of test names to run
46
47
  mapping_db_path: Path to mapping database
47
48
  verbose: Print verbose output
49
+ pytest_args: Additional pytest arguments
48
50
 
49
51
  Returns:
50
52
  Tuple of (passed_tests, failed_tests)
@@ -59,7 +61,10 @@ def run_test_chunk_with_mapping(
59
61
  "--cov-report=",
60
62
  "-v",
61
63
  "--tb=short",
62
- ] + test_names
64
+ ]
65
+ if pytest_args:
66
+ cmd.extend(pytest_args)
67
+ cmd.extend(test_names)
63
68
 
64
69
  print(f" Running: {' '.join(cmd[:6])} ... {len(test_names)} tests", flush=True)
65
70
 
@@ -152,7 +157,8 @@ def build_mapping_iteratively(
152
157
  repo_root: Path,
153
158
  mapping_db: Path,
154
159
  test_dir: str = "unit_tests",
155
- verbose: bool = False
160
+ verbose: bool = False,
161
+ pytest_args: list = None
156
162
  ):
157
163
  """
158
164
  Build mapping database by running unmapped tests.
@@ -164,6 +170,7 @@ def build_mapping_iteratively(
164
170
  mapping_db: Path to mapping database
165
171
  test_dir: Test directory to collect from (default: "unit_tests")
166
172
  verbose: Print verbose output
173
+ pytest_args: Additional pytest arguments
167
174
  """
168
175
  repo_root = repo_root.resolve()
169
176
 
@@ -223,7 +230,8 @@ def build_mapping_iteratively(
223
230
  repo_root,
224
231
  chunk,
225
232
  mapping_db,
226
- verbose
233
+ verbose,
234
+ pytest_args
227
235
  )
228
236
 
229
237
  # Track for final statistics
@@ -244,7 +252,8 @@ def build_mapping_iteratively(
244
252
  repo_root,
245
253
  remaining_list,
246
254
  mapping_db,
247
- verbose
255
+ verbose,
256
+ pytest_args
248
257
  )
249
258
 
250
259
  # Track for final statistics
@@ -290,6 +290,8 @@ def cmd_run(args):
290
290
 
291
291
  # Remove '--' separator if present in pytest_args
292
292
  pytest_extra_args = args.pytest_args
293
+ if hasattr(args, 'unknown_args') and args.unknown_args:
294
+ pytest_extra_args.extend(args.unknown_args)
293
295
  if pytest_extra_args and pytest_extra_args[0] == '--':
294
296
  pytest_extra_args = pytest_extra_args[1:]
295
297
 
@@ -361,11 +363,18 @@ def cmd_build_mapping(args):
361
363
  # Use args.test_dir if explicitly provided and not the default "tests", otherwise use config
362
364
  final_test_dir = args.test_dir if args.test_dir != "tests" else default_test_dir
363
365
 
366
+ pytest_args = getattr(args, 'pytest_args', [])
367
+ if hasattr(args, 'unknown_args') and args.unknown_args:
368
+ pytest_args.extend(args.unknown_args)
369
+ if pytest_args and pytest_args[0] == '--':
370
+ pytest_args = pytest_args[1:]
371
+
364
372
  sys.exit(build_mapping_iteratively(
365
373
  repo_root,
366
374
  mapping_db,
367
375
  test_dir=final_test_dir,
368
- verbose=args.verbose
376
+ verbose=args.verbose,
377
+ pytest_args=pytest_args
369
378
  ))
370
379
 
371
380
 
@@ -723,6 +732,11 @@ Examples:
723
732
  action="store_true",
724
733
  help="Verbose output"
725
734
  )
735
+ build_parser.add_argument(
736
+ "pytest_args",
737
+ nargs=argparse.REMAINDER,
738
+ help="Additional arguments to pass to pytest (after --, e.g. -n auto -k foo)"
739
+ )
726
740
  build_parser.set_defaults(func=cmd_build_mapping)
727
741
 
728
742
  # Login command
@@ -782,13 +796,15 @@ Examples:
782
796
  push_parser.set_defaults(func=cmd_push)
783
797
 
784
798
  # Parse arguments
785
- args = parser.parse_args()
799
+ args, unknown = parser.parse_known_args()
786
800
 
787
801
  # If no command specified, default to 'run'
788
802
  if not args.command:
789
803
  # Parse as 'run' command for backward compatibility
790
804
  run_args = ['run'] + sys.argv[1:]
791
- args = parser.parse_args(run_args)
805
+ args, unknown = parser.parse_known_args(run_args)
806
+
807
+ args.unknown_args = unknown
792
808
 
793
809
  # Execute command
794
810
  if hasattr(args, 'func'):
@@ -159,8 +159,20 @@ def pytest_sessionfinish(session, exitstatus):
159
159
  pintest_dir = Path(session.config.rootdir) / ".pintest"
160
160
  pintest_dir.mkdir(parents=True, exist_ok=True)
161
161
  out_file = pintest_dir / "durations.json"
162
+
163
+ # Load existing durations if present to merge/upsert them
164
+ existing_durations = {}
165
+ if out_file.exists():
166
+ try:
167
+ with open(out_file, "r") as f:
168
+ existing_durations = json.load(f)
169
+ except Exception:
170
+ pass
171
+
172
+ existing_durations.update(test_durations)
173
+
162
174
  with open(out_file, "w") as f:
163
- json.dump(test_durations, f)
175
+ json.dump(existing_durations, f)
164
176
  except Exception as e:
165
177
  # Silently pass if we cannot write to rootdir
166
178
  pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pintest-cli
3
- Version: 0.3.3
3
+ Version: 0.3.5
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.3.3",
8
+ version="0.3.5",
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