Spaces:
Running
Running
PromptAid Vision Tests
This folder contains all test files for the PromptAid Vision application.
Test Files
Core Application Tests
test_core.py
- Core application functionality testtest_hf.py
- Hugging Face integration test
Test Utilities
test.jpg
- Test image for image processing testsrun_tests.py
- Run all tests
Running Tests
Run All Tests
cd py_backend
python tests/run_tests.py
Run Individual Tests
cd py_backend
python tests/test_core.py
python tests/test_hf.py
Prerequisites
Before running the tests, ensure you have:
Environment Variables Set:
cp .env.example .env
Required API Keys:
HF_API_KEY
- Hugging Face API keyOPENAI_API_KEY
- OpenAI API key (for GPT-4 Vision)GOOGLE_API_KEY
- Google API key (for Gemini Vision)
Dependencies Installed:
pip install -r requirements.txt
Database Running:
- PostgreSQL database accessible
- Environment variables for database connection
Test Results
Tests will show:
- SUCCESS - Test completed successfully
- ERROR - Test encountered errors
- TIMEOUT - Test took too long
- WARNING - Unexpected error occurred
Troubleshooting
Common Issues
- Import Errors: Tests automatically add the parent directory to Python path
- API Key Issues: Ensure your API keys are valid and have proper permissions
- Database Connection: Check database credentials and connection
- Timeout Issues: Some tests may take longer on first run due to model loading
Debug Mode
For detailed debugging, run individual tests directly:
python tests/test_core.py
Logs
Check the console output for detailed error messages and debugging information.
Adding New Tests
When adding new tests:
- Place in tests folder with descriptive filename
- Update run_tests.py to include the new test
- Fix imports if importing from app modules
- Add to README with description
Related Documentation
TROUBLESHOOTING_HF.md
- Hugging Face API troubleshooting guideHUGGINGFACE_INTEGRATION.md
- Hugging Face integration documentation