policyengine-us 1.389.0__py3-none-any.whl → 1.389.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.
Potentially problematic release.
This version of policyengine-us might be problematic. Click here for more details.
- policyengine_us/tests/run_selective_tests.py +105 -3
- {policyengine_us-1.389.0.dist-info → policyengine_us-1.389.1.dist-info}/METADATA +1 -1
- {policyengine_us-1.389.0.dist-info → policyengine_us-1.389.1.dist-info}/RECORD +6 -6
- {policyengine_us-1.389.0.dist-info → policyengine_us-1.389.1.dist-info}/WHEEL +0 -0
- {policyengine_us-1.389.0.dist-info → policyengine_us-1.389.1.dist-info}/entry_points.txt +0 -0
- {policyengine_us-1.389.0.dist-info → policyengine_us-1.389.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -289,6 +289,11 @@ class SelectiveTestRunner:
|
|
|
289
289
|
|
|
290
290
|
# Special handling for test files themselves
|
|
291
291
|
if "tests" in file and file.endswith(".py"):
|
|
292
|
+
# Skip test infrastructure files that shouldn't trigger all tests
|
|
293
|
+
if file.endswith(
|
|
294
|
+
("run_selective_tests.py", "test_batched.py")
|
|
295
|
+
):
|
|
296
|
+
continue
|
|
292
297
|
# Add the directory containing the test file
|
|
293
298
|
test_dir = os.path.dirname(file)
|
|
294
299
|
if test_dir:
|
|
@@ -314,7 +319,13 @@ class SelectiveTestRunner:
|
|
|
314
319
|
|
|
315
320
|
return existing_test_paths
|
|
316
321
|
|
|
317
|
-
def run_tests(
|
|
322
|
+
def run_tests(
|
|
323
|
+
self,
|
|
324
|
+
test_paths: Set[str],
|
|
325
|
+
verbose: bool = False,
|
|
326
|
+
with_coverage: bool = False,
|
|
327
|
+
changed_files: Set[str] = None,
|
|
328
|
+
) -> int:
|
|
318
329
|
"""Run pytest on specified test paths."""
|
|
319
330
|
if not test_paths:
|
|
320
331
|
print("No relevant tests found for changed files.")
|
|
@@ -325,7 +336,86 @@ class SelectiveTestRunner:
|
|
|
325
336
|
print(f" - {path}")
|
|
326
337
|
|
|
327
338
|
# Construct pytest command
|
|
328
|
-
|
|
339
|
+
if with_coverage:
|
|
340
|
+
# Use coverage to run the tests
|
|
341
|
+
import sys
|
|
342
|
+
|
|
343
|
+
# First check if coverage is importable
|
|
344
|
+
try:
|
|
345
|
+
import coverage
|
|
346
|
+
|
|
347
|
+
print(f"Coverage version: {coverage.__version__}")
|
|
348
|
+
except ImportError as e:
|
|
349
|
+
print(f"ERROR: Coverage module not found: {e}")
|
|
350
|
+
print(
|
|
351
|
+
"Please ensure coverage is installed: pip install coverage"
|
|
352
|
+
)
|
|
353
|
+
return 1
|
|
354
|
+
|
|
355
|
+
# Only track coverage for the specific files that changed in the PR
|
|
356
|
+
include_patterns = []
|
|
357
|
+
if changed_files:
|
|
358
|
+
# Only include Python files that were actually changed (excluding test directories)
|
|
359
|
+
changed_py_files = [
|
|
360
|
+
f
|
|
361
|
+
for f in changed_files
|
|
362
|
+
if f.endswith(".py") and "/tests/" not in f
|
|
363
|
+
]
|
|
364
|
+
if changed_py_files:
|
|
365
|
+
include_patterns = changed_py_files
|
|
366
|
+
else:
|
|
367
|
+
# Fallback to directory-based patterns if no changed files provided
|
|
368
|
+
for test_path in test_paths:
|
|
369
|
+
# Convert test path to variable path
|
|
370
|
+
if "tests/policy/baseline/" in test_path:
|
|
371
|
+
var_path = test_path.replace(
|
|
372
|
+
"tests/policy/baseline/", "variables/"
|
|
373
|
+
)
|
|
374
|
+
include_patterns.append(f"{var_path}/**/*.py")
|
|
375
|
+
include_patterns.append(f"{var_path}/*.py")
|
|
376
|
+
elif "tests/policy/reform/" in test_path:
|
|
377
|
+
include_patterns.append(
|
|
378
|
+
"policyengine_us/reforms/**/*.py"
|
|
379
|
+
)
|
|
380
|
+
include_patterns.append("policyengine_us/reforms/*.py")
|
|
381
|
+
elif "tests/policy/contrib/" in test_path:
|
|
382
|
+
include_patterns.append(
|
|
383
|
+
"policyengine_us/parameters/contrib/**/*.py"
|
|
384
|
+
)
|
|
385
|
+
include_patterns.append(
|
|
386
|
+
"policyengine_us/parameters/contrib/*.py"
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
pytest_args = [
|
|
390
|
+
sys.executable,
|
|
391
|
+
"-m",
|
|
392
|
+
"coverage",
|
|
393
|
+
"run",
|
|
394
|
+
"-a",
|
|
395
|
+
"--branch",
|
|
396
|
+
]
|
|
397
|
+
|
|
398
|
+
# Add --include flag to only track relevant files
|
|
399
|
+
if include_patterns:
|
|
400
|
+
include_pattern = ",".join(include_patterns)
|
|
401
|
+
pytest_args.extend(["--include", include_pattern])
|
|
402
|
+
|
|
403
|
+
pytest_args.extend(
|
|
404
|
+
[
|
|
405
|
+
"-m",
|
|
406
|
+
"policyengine_core.scripts.policyengine_command",
|
|
407
|
+
"test",
|
|
408
|
+
"-c",
|
|
409
|
+
"policyengine_us",
|
|
410
|
+
]
|
|
411
|
+
)
|
|
412
|
+
else:
|
|
413
|
+
pytest_args = [
|
|
414
|
+
"policyengine-core",
|
|
415
|
+
"test",
|
|
416
|
+
"-c",
|
|
417
|
+
"policyengine_us",
|
|
418
|
+
]
|
|
329
419
|
|
|
330
420
|
# Add test paths
|
|
331
421
|
pytest_args.extend(sorted(test_paths))
|
|
@@ -409,6 +499,11 @@ def main():
|
|
|
409
499
|
action="store_true",
|
|
410
500
|
help="Show debug information about git state",
|
|
411
501
|
)
|
|
502
|
+
parser.add_argument(
|
|
503
|
+
"--coverage",
|
|
504
|
+
action="store_true",
|
|
505
|
+
help="Run tests with coverage measurement",
|
|
506
|
+
)
|
|
412
507
|
|
|
413
508
|
args = parser.parse_args()
|
|
414
509
|
|
|
@@ -508,7 +603,14 @@ def main():
|
|
|
508
603
|
print("Consider running all tests with --all flag.")
|
|
509
604
|
sys.exit(0)
|
|
510
605
|
|
|
511
|
-
sys.exit(
|
|
606
|
+
sys.exit(
|
|
607
|
+
runner.run_tests(
|
|
608
|
+
test_paths,
|
|
609
|
+
verbose=args.verbose,
|
|
610
|
+
with_coverage=args.coverage,
|
|
611
|
+
changed_files=changed_files if args.coverage else None,
|
|
612
|
+
)
|
|
613
|
+
)
|
|
512
614
|
|
|
513
615
|
|
|
514
616
|
if __name__ == "__main__":
|
|
@@ -3190,7 +3190,7 @@ policyengine_us/reforms/tax_exempt/__init__.py,sha256=v3EbtUk6a2jsi9MrOlyb8ckzPy
|
|
|
3190
3190
|
policyengine_us/reforms/tax_exempt/tax_exempt_reform.py,sha256=bkW91XMJ-jd23nhq4-PfWJv0YW2whVn98cQikbq6-Z8,2427
|
|
3191
3191
|
policyengine_us/reforms/treasury/__init__.py,sha256=406jIbu32B57tUKhVLflWxlXf3S4SWjclVqlEtMeMwg,92
|
|
3192
3192
|
policyengine_us/reforms/treasury/repeal_dependent_exemptions.py,sha256=-xyMCtUK_dIBn2aAmhPW8pJEZjxcgOZzWKEUSI3w5e8,1354
|
|
3193
|
-
policyengine_us/tests/run_selective_tests.py,sha256=
|
|
3193
|
+
policyengine_us/tests/run_selective_tests.py,sha256=kVuz9-CEXL2db8MuFi1J3cHj_Mqx28retvAPX8N3LCY,22571
|
|
3194
3194
|
policyengine_us/tests/test_batched.py,sha256=K1LN3IIbWIioXWpFXZ6Hlch-BeglV3QPc1zxAbUeP-M,11491
|
|
3195
3195
|
policyengine_us/tests/code_health/parameters.py,sha256=e9VKC8dmmB_dTafOO90WJuVu-PAogoLAaa5QZd2rY-s,1126
|
|
3196
3196
|
policyengine_us/tests/code_health/variable_names.py,sha256=hY4ucqPwBD7v_fvnBpzexJDf0yCGpF4Sueff4z4rQ24,554
|
|
@@ -8378,8 +8378,8 @@ policyengine_us/variables/input/farm_income.py,sha256=BEKxYmHNNnWJAAvULl5qZJigy5
|
|
|
8378
8378
|
policyengine_us/variables/input/geography.py,sha256=Ux0ueAf0rhZaflyEqz81UuXP3xKCKBDvoO3CrKhiQEc,5421
|
|
8379
8379
|
policyengine_us/variables/input/self_employment_income.py,sha256=PwsGz8R4lRikKWUYOhsC0qosNNLXq4f5SQmfw4S3mk8,511
|
|
8380
8380
|
policyengine_us/variables/input/self_employment_income_before_lsr.py,sha256=E8fcX9Nlyqz8dziHhQv_euutdmoIwFMMWePUwbbwv_w,379
|
|
8381
|
-
policyengine_us-1.389.
|
|
8382
|
-
policyengine_us-1.389.
|
|
8383
|
-
policyengine_us-1.389.
|
|
8384
|
-
policyengine_us-1.389.
|
|
8385
|
-
policyengine_us-1.389.
|
|
8381
|
+
policyengine_us-1.389.1.dist-info/METADATA,sha256=-4H82MCggJ3clZoCBNAL5GXdJSmtr96COTxL1VzK1SU,1649
|
|
8382
|
+
policyengine_us-1.389.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8383
|
+
policyengine_us-1.389.1.dist-info/entry_points.txt,sha256=MLaqNyNTbReALyKNkde85VkuFFpdPWAcy8VRG1mjczc,57
|
|
8384
|
+
policyengine_us-1.389.1.dist-info/licenses/LICENSE,sha256=2N5ReRelkdqkR9a-KP-y-shmcD5P62XoYiG-miLTAzo,34519
|
|
8385
|
+
policyengine_us-1.389.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|