Generate production-ready pytest unit tests.
Project description
utg-pkg
utg-pkg is a CLI tool that uses Google Gemini to generate production-ready pytest unit tests from your Python code.
🚀 Features
- Full coverage test generation using AI
- Mocks file I/O, API calls, and databases where applicable
- Output is clean, modular, and
pytest-compliant - Easily customizable via CLI
- Great for legacy projects and automation
📦 Installation
From PyPI (once published)
pip install utg-pkg
From Source
git clone https://github.com/yourusername/utg-pkg.git
cd utg-pkg
pip install .
🔑 Environment Setup
Create a .env file in the root directory:
GEMINI_API_KEY=your_gemini_api_key_here
You can obtain a key from Google AI Studio.
💻 Usage
utg-pkg --source path/to/your/code --output path/to/generated_tests
Options:
--source: Directory to scan Python files (default:.)--output: Directory to write test files (default:tests/)
Example:
utg-pkg --source src/ --output unit_tests/
📁 Example Structure
Before:
src/
calculator.py
After:
unit_tests/
calculator_test.py # auto-generated test file
🧠 Example Output
def test_add_positive_numbers():
assert add(2, 3) == 5
📝 License
MIT © [Your Name]
🤖 Powered By
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
utg_pkg-0.1.0.tar.gz
(5.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file utg_pkg-0.1.0.tar.gz.
File metadata
- Download URL: utg_pkg-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5623952cd9f2874375639813f37c1eca8815f6722ca0ed732daffedf61194719
|
|
| MD5 |
507d92b232cc784aed0de836466d1847
|
|
| BLAKE2b-256 |
d692aa184995dd52e1e7e6bf70faa22beff1d615d267f78102ea151fe3e77c77
|
File details
Details for the file utg_pkg-0.1.0-py3-none-any.whl.
File metadata
- Download URL: utg_pkg-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49d27a0468a9407fd74650d1ffa06426ef80ef12aeda97b7c07b565dcd7e3ab3
|
|
| MD5 |
1923a40558736711a15819793e757c29
|
|
| BLAKE2b-256 |
b441710652bbf65404002e671bc407b79a2ab2a05a0d1350c0c5d38c63825b04
|