function test_full_analyzer
Tests the full contract analyzer pipeline by running a dry-run analysis on a limited number of files to verify the system is working correctly.
/tf/active/vicechatdev/contract_validity_analyzer/test_implementation.py
154 - 172
simple
Purpose
This function serves as an integration test for the ContractAnalyzer system. It validates that the entire analyzer pipeline (including configuration, file processing, and analysis) is properly set up and functional. It runs in dry-run mode with a maximum of 2 files to quickly verify system health without processing all available contracts. This is useful for smoke testing, CI/CD validation, and troubleshooting setup issues.
Source Code
def test_full_analyzer(config):
"""Test the full analyzer pipeline."""
print("\nTesting full analyzer pipeline...")
try:
analyzer = ContractAnalyzer(config)
# Run in dry-run mode to test the pipeline without processing all files
print(" Running dry-run analysis...")
results = analyzer.analyze_contracts(dry_run=True, max_files=2)
print(f"✓ Full analyzer pipeline works")
print(f" Would process {len(results)} files")
return True
except Exception as e:
print(f"✗ Full analyzer failed: {e}")
return False
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
config |
- | - | positional_or_keyword |
Parameter Details
config: A Config object containing all necessary configuration settings for the ContractAnalyzer, including paths, API credentials, processing parameters, and other system settings. This should be an instance of the Config class from config.config module.
Return Value
Returns a boolean value: True if the analyzer pipeline successfully completes the dry-run test without errors, False if any exception occurs during testing. The function also prints status messages to stdout indicating success or failure details.
Dependencies
pathlibloggingtempfileioreportlab
Required Imports
from config.config import Config
from core.analyzer import ContractAnalyzer
Usage Example
from config.config import Config
from pathlib import Path
# Initialize configuration
config = Config()
config.filecloud_url = 'https://your-filecloud-instance.com'
config.filecloud_username = 'your_username'
config.filecloud_password = 'your_password'
config.llm_api_key = 'your_api_key'
config.contracts_path = Path('/path/to/contracts')
# Run the test
success = test_full_analyzer(config)
if success:
print('Analyzer pipeline is ready')
else:
print('Analyzer pipeline has issues')
Best Practices
- Always run this test before processing large batches of contracts to ensure the system is properly configured
- Use this function as part of CI/CD pipelines to validate deployment configurations
- The dry_run=True and max_files=2 parameters ensure quick execution without consuming significant API credits or processing time
- Monitor the printed output for detailed information about what would be processed
- Ensure the config object is fully initialized with all required credentials and settings before calling this function
- This function prints to stdout, so capture or redirect output appropriately in automated testing environments
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
function main_v22 72.4% similar
-
function test_with_real_documents 63.1% similar
-
function main_v7 61.3% similar
-
function main_v6 61.1% similar
-
function test_llm_extraction 58.1% similar