Skip to content

Commit

Permalink
refactor: Remove coverage analysis method and related exception
Browse files Browse the repository at this point in the history
- Simplify mutation testing controller by removing separate coverage analysis method
- Directly call dry_run() in the main run method
- Remove CoverageAnalysisError exception as it's no longer needed
  • Loading branch information
jungs1 committed Mar 6, 2025
1 parent 5fbbcbb commit ab603d5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
15 changes: 1 addition & 14 deletions src/mutahunter/core/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from mutahunter.core.analyzer import Analyzer
from mutahunter.core.entities.config import MutationTestControllerConfig
from mutahunter.core.exceptions import (
CoverageAnalysisError,
MutantKilledError,
MutantSurvivedError,
MutationTestingError,
Expand Down Expand Up @@ -54,11 +53,7 @@ def __init__(
def run(self) -> None:
start = time.time()
try:
self.run_coverage_analysis()
except CoverageAnalysisError as e:
logger.error(f"Coverage analysis failed: {str(e)}")
return
try:
self.test_runner.dry_run()
self.run_mutation_testing()
except MutationTestingError as e:
logger.error(f"Mutation testing failed: {str(e)}")
Expand All @@ -79,15 +74,7 @@ def run(self) -> None:
logger.error(f"Report generation failed: {str(e)}")
logger.info(f"Mutation Testing Ended. Took {round(time.time() - start)}s")

def run_coverage_analysis(self) -> None:

logger.info("Starting Coverage Analysis...")
try:
self.test_runner.dry_run()
except Exception as e:
raise CoverageAnalysisError(
f"Failed to complete coverage analysis: {str(e)}"
)

def run_mutation_testing(self) -> None:
mutations = self.engine.generate(
Expand Down
3 changes: 0 additions & 3 deletions src/mutahunter/core/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ class MutantKilledError(Exception):
pass


class CoverageAnalysisError(Exception):
pass


class MutationTestingError(Exception):
pass
Expand Down

0 comments on commit ab603d5

Please sign in to comment.