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
-
Navigate to the Project Root Directory
Go to thecli-tooldirectory wheresetup.pyis located:cd path/to/cli-tool
-
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)
- A source distribution (
-
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.
-
Verify the Package on PyPI
After uploading, visit https://pypi.org/project/testforge to verify that the package is live. -
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:
-
Update the Version in
setup.py
Increment the version number insetup.py. For example, if the current version is1.0.0, update it to1.0.1for a minor change,1.1.0for a new feature, or2.0.0for a major update.setup( name="testforge", version="1.0.1", # Updated version number # other parameters... )
-
Clean Up Previous Builds
Delete old distribution files to avoid confusion:rm -rf dist/
-
Build the New Distribution Files
From thecli-tooldirectory, rebuild the package:python3 setup.py sdist bdist_wheel
-
Upload the New Version to PyPI
Use Twine to upload the new distribution files:twine upload dist/*
-
Verify the New Version on PyPI
Check https://pypi.org/project/testforge to confirm that the new version is live. -
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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe44d10218d12a6562eda94a19c2d030d650ee70693997ae37e499eedaafbc1b
|
|
| MD5 |
12dbd25b9b67d72e484a0807c5fc58bb
|
|
| BLAKE2b-256 |
bde3cd1ce8788dfaed39c4f3106c21d2bb9b1359027dcd29442c6a3b6aea2860
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9577edec74706856c6a85e17f35d7747e49b0e95ad814b626faa0ac08247994
|
|
| MD5 |
2f6ff82f5f44c4b3c028412a210da67b
|
|
| BLAKE2b-256 |
65470c7d28892044b525b4a8da5df3a1114c265df7d95d269dbce0c930eda920
|