Skip to main content

A CLI tool to generate pytest test cases using AI.

Project description

TestForge

TestForge is a command-line tool designed to help automate the creation of test files using pytest. This tool can compress project files, send them to a specified cloud endpoint, and generate pytest cases for a given directory.

Features

  • Version Check: Show the current version of TestForge.
  • Help: Provides usage instructions.
  • Generate Tests: Automatically generate pytest test cases for a specified directory.
  • Output Directory: Specify an output directory for the generated test files (default is tests).

Installation

To install TestForge, clone the repository and run:

python3 setup.py sdist bdist_wheel
pip install .

Usage

TestForge provides several options that can be used in the command line:

  • Show Version: Check the version of TestForge.

    testforge -v
    
  • Generate Tests: Generate pytest cases for a specified directory.

    testforge -g path/to/your/directory
    
  • Specify Output Directory: Define a custom directory for the generated test files.

    testforge -g path/to/your/directory -o custom_output_directory
    

Example

testforge -g src -o tests

This command will generate test files for the src directory and save them in the tests folder.

Development

If you want to contribute to the development of TestForge, clone the repository, make your changes, and submit a pull request.

Building and Publishing Guide

This section provides a step-by-step guide to build, publish, and update testforge on PyPI.

Prerequisites

  • Python 3.6+
  • Twine for uploading the package to PyPI

Install Twine (if not already installed):

pip install twine

Project Structure

Ensure the project has the following structure:

cli-tool/
├── setup.py
├── README.md
├── LICENSE
├── testforge/
│   ├── __init__.py
│   └── cli.py
└── tests/

Steps to Build and Publish the First Version

  1. Navigate to the Project Root Directory
    Go to the cli-tool directory where setup.py is located:

    cd path/to/cli-tool
    
  2. Build the Package
    Generate distribution files using the following command:

    python3 setup.py sdist bdist_wheel
    

    This command creates a dist/ folder with two files:

    • A source distribution (.tar.gz)
    • A wheel distribution (.whl)
  3. Upload to PyPI
    Use Twine to upload the package to PyPI:

    twine upload dist/*
    

    You will be prompted to enter your PyPI username and password.

  4. Verify the Package on PyPI
    After uploading, visit https://pypi.org/project/testforge to verify that the package is live.

  5. Test Installation
    Once published, you can install the package using:

    pip install testforge
    

    Test the CLI tool by running:

    testforge -v
    

Publishing a New Version

To publish an updated version of testforge, follow these steps:

  1. Update the Version in setup.py
    Increment the version number in setup.py. For example, if the current version is 1.0.0, update it to 1.0.1 for a minor change, 1.1.0 for a new feature, or 2.0.0 for a major update.

    setup(
        name="testforge",
        version="1.0.1",  # Updated version number
        # other parameters...
    )
    
  2. Clean Up Previous Builds
    Delete old distribution files to avoid confusion:

    rm -rf dist/
    
  3. Build the New Distribution Files
    From the cli-tool directory, rebuild the package:

    python3 setup.py sdist bdist_wheel
    
  4. Upload the New Version to PyPI
    Use Twine to upload the new distribution files:

    twine upload dist/*
    
  5. Verify the New Version on PyPI
    Check https://pypi.org/project/testforge to confirm that the new version is live.

  6. Test the New Version
    Install the latest version to ensure it’s accessible:

    pip install --upgrade testforge
    

    Run the CLI tool to confirm the version:

    testforge -v
    

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

testforge-1.0.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

testforge-1.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file testforge-1.0.1.tar.gz.

File metadata

  • Download URL: testforge-1.0.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for testforge-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fe44d10218d12a6562eda94a19c2d030d650ee70693997ae37e499eedaafbc1b
MD5 12dbd25b9b67d72e484a0807c5fc58bb
BLAKE2b-256 bde3cd1ce8788dfaed39c4f3106c21d2bb9b1359027dcd29442c6a3b6aea2860

See more details on using hashes here.

File details

Details for the file testforge-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: testforge-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for testforge-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9577edec74706856c6a85e17f35d7747e49b0e95ad814b626faa0ac08247994
MD5 2f6ff82f5f44c4b3c028412a210da67b
BLAKE2b-256 65470c7d28892044b525b4a8da5df3a1114c265df7d95d269dbce0c930eda920

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