ghtest package¶
Submodules¶
- ghtest.analyze_tests module
- ghtest.cassette_sanitizer module
- ghtest.cli module
- ghtest.core module
- ghtest.coverage_analysis module
- ghtest.create_tests_workflow module
- ghtest.param_suggestor module
- ghtest.scanner module
FunctionInfoFunctionInfo.crud_resourceFunctionInfo.crud_roleFunctionInfo.docstringFunctionInfo.filepathFunctionInfo.import_object()FunctionInfo.linenoFunctionInfo.moduleFunctionInfo.module_call_valuesFunctionInfo.module_functionsFunctionInfo.module_globalsFunctionInfo.module_param_valuesFunctionInfo.parameter_usage_valuesFunctionInfo.parametersFunctionInfo.qualnameFunctionInfo.returnsFunctionInfo.sample_callsFunctionInfo.unused_parameters
ParameterInfoscan_python_functions()
- ghtest.test_utils module
- ghtest.tests_creator module
- ghtest.tests_writer module
Module contents¶
- ghtest.make_test(suggestion: SuggestedFunctionTests, cassette_dir: str, record_mode: str = 'once', volatile_response_fields: Sequence[str] | None = None) GeneratedTest¶
- ghtest.print_test_summary(cassette_dir='testdata_tests/cassettes', test_dir='testdata_tests', src_dir='testdata', data_dir='data', test_objects_dir='testdata_test_objects', refresh=False, vb=0)[source]¶
Print tests statistics like tested functions, request return codes etc.
- Parameters:
cassette_dir (str) – folder with vcr cassettes
test_dir (str) – folder with tests
src_dir (str) – folder with source under test
data_dir (str) – data folder within tests to ignore
test_objects_dir (str) – folder with test objects
refresh (bool) – create tests before showing detailed stats, else try to load from disk
vb (int) – detail level
- Returns:
None
- Side Effects:
prints to stdout
- ghtest.scan(root: str) List[FunctionInfo]¶
Recursively scan a folder for Python functions (including methods in classes).
Returns a list of FunctionInfo objects with module name, qualified name, source file path, parameters, return annotation, and docstring.
- ghtest.suggest(func: FunctionInfo, test_functions: List[FunctionInfo] | None = None, *, literal_only: bool = False, coverage_data: Any | None = None) SuggestedFunctionTests¶
Suggest parameter sets for tests of a single FunctionInfo.
Uses three sources, in order of preference: 1) Existing test functions (from a tests folder) that call the function. 2) A minimal set using only required parameters (skipping self/cls). 3) Additional sets where defaulted parameters are given alternative values.
test_functions should be the scanner results from the tests directory.
- ghtest.write_module(artifacts: Sequence[TestArtifact], output_dir: str, *, max_cases_per_module: int = 10, inline_char_limit: int = 160, include_scenarios: bool = True, include_return_summary: bool = True, exception_assertion: Literal['message', 'type', 'presence', 'none'] = 'type') TestWriterResult¶
- ghtest.write_tests(src_dir, test_dir, cassette_dir)¶