Skip to main content

Generate production-ready pytest unit tests.

Project description

utg-pkg

PyPI version License: MIT

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/G5277/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 © Gazal


🤖 Powered By

Project details


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.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

utg_pkg-0.1.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file utg_pkg-0.1.1.tar.gz.

File metadata

  • Download URL: utg_pkg-0.1.1.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

Hashes for utg_pkg-0.1.1.tar.gz
Algorithm Hash digest
SHA256 98c7167b3bfc9bd24fdfd0956710aa498f4aa2720a506531a13dca7989726311
MD5 ce4fc9921983e87d12cae8636140f2f4
BLAKE2b-256 0ce0857fcb7fcc4645bbdeefc06faa3278eb3fb6a4be18b9de4ee10a2898d3fd

See more details on using hashes here.

File details

Details for the file utg_pkg-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: utg_pkg-0.1.1-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

Hashes for utg_pkg-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf4f0ec4ed5dc1e35dca3131d698a8a7a8d117420be979edff3d7f3f4bf5b2e0
MD5 d47dd9485ec3a49ad1c72c6108c1641e
BLAKE2b-256 0d3eed7230a80ebb5df8dd63b8e1de0c83e1fff0f3ff9abf2d8e7f750a68c811

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page