Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve tests to avoid leaving leftovers.#244

Merged
vitenti merged 3 commits into
masterfrom
tmp_test_files
May 2, 2026
Merged

Improve tests to avoid leaving leftovers.#244
vitenti merged 3 commits into
masterfrom
tmp_test_files

Conversation

@vitenti

@vitenti vitenti commented May 2, 2026

Copy link
Copy Markdown
Contributor

Improve tests to avoid leaving leftovers.
Improving tests type hints.

Improving tests type hints.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the cluster-richness analysis tests and CLI/library plumbing so test-generated analysis artifacts can be redirected away from the repository root. It mainly adds explicit typing in tests and introduces an --output-dir path that is threaded through the analysis pipeline.

Changes:

  • Add --output-dir to the cluster-richness CLI and pass it through to real-analysis and mock-study output generation.
  • Extend CutAnalyzer, MockStudy, and BestfitDatabase path handling to use Path objects and base directories for generated files.
  • Tighten Python test type hints and update several app tests to use tmp_path for output isolation.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/python/app/test_cluster_richness_app.py Adds type annotations and updates several CLI tests to pass --output-dir/tmp_path.
tests/python/analysis/test_cluster_richness_diagnostics.py Adds return/parameter annotations and minor local variable renames in diagnostics tests.
tests/python/analysis/test_cluster_richness_analyzer.py Adds fixture/test type hints and small local variable renames in analyzer tests.
numcosmo_py/app/cluster_richness.py Introduces CLI --output-dir and forwards it into analysis/mock-study execution.
numcosmo_py/analysis/cluster_richness/_mock_study.py Adds base_dir/Path handling for output files and cached database location.
numcosmo_py/analysis/cluster_richness/_database.py Changes database path typing from str to Path.
numcosmo_py/analysis/cluster_richness/_analyzer.py Adds base_dir support when writing MCMC/bootstrap FITS outputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

self.base_dir = base_dir if base_dir is not None else Path(".")
self.mock_results: list[dict[float, CutAnalysisResult]] = []
self.fiducial_results = fiducial_results
self.verbose = verbose
Comment on lines 379 to +382
"--output-prefix",
output_prefix,
"test_output",
"--output-dir",
tmp_path.as_posix(),
help="Directory for output files (default: current directory).",
),
] = None

@codecov

codecov Bot commented May 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.49%. Comparing base (b2ab0a4) to head (fda43f5).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #244      +/-   ##
==========================================
+ Coverage   77.44%   77.49%   +0.04%     
==========================================
  Files         663      663              
  Lines      110623   110631       +8     
==========================================
+ Hits        85676    85734      +58     
+ Misses      24947    24897      -50     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vitenti vitenti merged commit 6147623 into master May 2, 2026
12 of 16 checks passed
@vitenti vitenti deleted the tmp_test_files branch May 2, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants