How se2p/pynguin works
Pynguin is a command-line tool that automatically generates Python unit tests for a subject module. The principal workflow is to configure a run, analyse the module, search for tests, execute them to measure coverage, and emit a test suite and statistics. The tree and README establish the product and its invocation; indexed references and excerpts support several internal relationships. Some major subsystems—such as instrumentation, mock generation, and distributed search—are represented from the tree, but their connections are not asserted where source evidence was not shown.
Main entry points: testcasechromosome.py Test candidate · generator.py Generation coordinator · testcase.py Test representation · llmtestcasehandler.py LLM test parsing
Components 25
Run setup
- Command-line interface
src/pynguin/cli.py - Run configuration
src/pynguin/configuration.py - Generation coordinator
src/pynguin/generator.py
Subject analysis
- Module analysis
src/pynguin/analyses/module.py - Type analysis
src/pynguin/analyses/typesystem.py - Callable model
src/pynguin/utils/generic/genericaccessibleobject.py - Ordered collections
src/pynguin/utils/orderedset.py
Test search
- Test construction
src/pynguin/testcase/testfactory.py - Test representation
src/pynguin/testcase/testcase.py - Test candidate
src/pynguin/ga/testcasechromosome.py - Suite candidate
src/pynguin/ga/testsuitechromosome.py - Search algorithms
src/pynguin/ga/algorithms
Execution and feedback
- Fitness and coverage
src/pynguin/ga/computations.py - Test execution
src/pynguin/testcase/execution.py - Runtime instrumentation
src/pynguin/instrumentation/tracer.py - Assertion generation
src/pynguin/assertion/assertiongenerator.py - Run statistics
src/pynguin/utils/statistics/stats.py
LLM and refinement
- LLM client
src/pynguin/large_language_model/client.py - LLM agent
src/pynguin/large_language_model/llmagent.py - LLM test parsing
src/pynguin/large_language_model/llmtestcasehandler.py - Test refinement
src/pynguin/refinement/pipeline.py - Mock generation
src/pynguin/mock_generation - Island search
src/pynguin/islands
Other components
- Developer
- Generated test output
Connections 28
- Developer → Command-line interface: invokes
README.md - Command-line interface → Generation coordinator: starts generation
- Generation coordinator → Run configuration: uses settings
src/pynguin/generator.py - Generation coordinator → Module analysis: analyses subject
src/pynguin/generator.py - Module analysis → Type analysis: uses type system
src/pynguin/analyses/module.py - Module analysis → Callable model: models callables
src/pynguin/analyses/module.py - Callable model → Type analysis: uses types
src/pynguin/utils/generic/genericaccessibleobject.py - Test construction → Test representation: builds tests
- Test candidate → Test representation: encodes test
src/pynguin/ga/testcasechromosome.py - Test candidate → Test construction: mutates through
src/pynguin/ga/testcasechromosome.py - Suite candidate → Test candidate: contains candidates
src/pynguin/ga/testsuitechromosome.py - Search algorithms → Test candidate: evolves candidates
src/pynguin/ga/algorithms/llmosalgorithm.py - Search algorithms → LLM agent: uses agent
src/pynguin/ga/algorithms/llmosalgorithm.py - Fitness and coverage → Test execution: executes candidates
src/pynguin/ga/computations.py - Fitness and coverage → Runtime instrumentation: uses trace data
src/pynguin/ga/coveragegoals.py - Test candidate → Test execution: executes test
src/pynguin/ga/testcasechromosome.py - LLM agent → LLM client: sends requests
src/pynguin/large_language_model/llmagent.py - LLM test parsing → Test representation: deserializes tests
src/pynguin/large_language_model/llmtestcasehandler.py - LLM test parsing → Test candidate: wraps test
src/pynguin/large_language_model/llmtestcasehandler.py - LLM test parsing → LLM agent: extracts output
src/pynguin/large_language_model/llmagent.py - Test refinement → LLM client: requests refinement
- Test refinement → Run configuration: reads settings
src/pynguin/refinement/pipeline.py - Test representation → Mock generation: uses mock generator
src/pynguin/testcase/testcase.py - Island search → Search algorithms: runs worker algorithm
src/pynguin/islands/llm_worker_algorithm.py - Run statistics → Run configuration: reads settings
src/pynguin/utils/statistics/stats.py - Generation coordinator → Generated test output: writes suite
README.md - Suite candidate → Assertion generation: receives assertions
- Run statistics → Generated test output: reports results