-
Notifications
You must be signed in to change notification settings - Fork 15
chore: release main #1514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: release main #1514
Changes from all commits
1a97f3b
530990c
35afe50
92f206d
b3fd6f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| ".": "0.2.45", | ||
| "packages/modelaudit-picklescan": "0.1.5" | ||
| ".": "0.2.46", | ||
| "packages/modelaudit-picklescan": "0.1.6" | ||
| } |
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| import os | ||
| import sys | ||
| import time | ||
| from pathlib import Path | ||
| from unittest.mock import patch | ||
|
|
||
| import pytest | ||
|
|
@@ -253,7 +254,12 @@ def test_large_file_scanning_performance(self, tmp_path): | |
| # Should complete within reasonable time | ||
| # CI environments may have variable performance; use generous thresholds | ||
| # to avoid flaky failures from runner contention (Linux ~2s, Windows ~4s typical) | ||
| has_runner_contention = bool(os.getenv("CI") or os.getenv("GITHUB_ACTIONS") or os.getenv("PYTEST_XDIST_WORKER")) | ||
| has_runner_contention = bool( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This edit makes Useful? React with 👍 / 👎. |
||
| os.getenv("CI") | ||
| or os.getenv("GITHUB_ACTIONS") | ||
| or os.getenv("PYTEST_XDIST_WORKER") | ||
| or os.getenv("PYTEST_XDIST_WORKER_COUNT") | ||
| ) | ||
| threshold = ( | ||
| (15.0 if sys.platform == "win32" else 12.0) | ||
| if has_runner_contention | ||
|
|
@@ -299,7 +305,7 @@ def test_multiple_files_scanning_performance(self, tmp_path): | |
| avg_time = total_duration / len(files) | ||
| print(f"Average scan time: {avg_time:.3f}s per file") | ||
|
|
||
| def test_validation_performance_impact(self, tmp_path): | ||
| def test_validation_performance_impact(self, tmp_path: Path) -> None: | ||
| """Test performance impact of file validation.""" | ||
| test_file = tmp_path / "validation_test.joblib" | ||
|
|
||
|
|
@@ -310,17 +316,31 @@ def test_validation_performance_impact(self, tmp_path): | |
|
|
||
| from modelaudit.scanners.pickle_scanner import _is_legitimate_serialization_file | ||
|
|
||
| iters = 30 if (os.getenv("CI") or os.getenv("GITHUB_ACTIONS")) else 100 | ||
| start_time = time.perf_counter() | ||
| for _ in range(iters): # Multiple calls to get meaningful measurement | ||
| _is_legitimate_serialization_file(str(test_file)) | ||
| validation_duration = time.perf_counter() - start_time | ||
|
|
||
| # Validation should be very fast | ||
| avg_validation_time = validation_duration / iters | ||
| assert avg_validation_time < 0.003 # Under 3ms average on bounded opcode scan | ||
| has_runner_contention = bool( | ||
| os.getenv("CI") | ||
| or os.getenv("GITHUB_ACTIONS") | ||
| or os.getenv("PYTEST_XDIST_WORKER") | ||
| or os.getenv("PYTEST_XDIST_WORKER_COUNT") | ||
| ) | ||
| iters = 30 if has_runner_contention else 60 | ||
| samples: list[float] = [] | ||
| _is_legitimate_serialization_file(str(test_file)) | ||
| for _ in range(5): | ||
| start_time = time.process_time() | ||
| for _ in range(iters): # Multiple calls to get meaningful measurement | ||
| _is_legitimate_serialization_file(str(test_file)) | ||
| samples.append((time.process_time() - start_time) / iters) | ||
|
|
||
| # Validation should use little CPU even when wall-clock scheduling is noisy. | ||
| avg_validation_time = min(samples) | ||
| threshold = 0.010 if sys.platform == "win32" else 0.006 | ||
| if has_runner_contention: | ||
| threshold *= 4.0 | ||
| assert avg_validation_time < threshold, ( | ||
| f"Fastest validation batch averaged {avg_validation_time:.6f}s, expected < {threshold:.3f}s" | ||
| ) | ||
|
|
||
| print(f"Average validation time: {avg_validation_time:.6f}s") | ||
| print(f"Average validation CPU time: {avg_validation_time:.6f}s") | ||
|
|
||
|
|
||
| class TestErrorScenarios: | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.