This is a simple Python application that calculates the square of a given number and prints it. The project also includes a test suite using pytest
to ensure the functionality of the application.
your-repo/
├── .github/
│ └── workflows/
│ └── python-app.yml
├── square_calculator.py
└── test_square_calculator.py
- square_calculator.py: Contains the main application logic.
- test_square_calculator.py: Contains the test suite for the application.
- .github/workflows/python-app.yml: Contains the GitHub Actions workflow.
-
Clone the repository:
git clone https://github.com/your-username/your-repo.git cd your-repo
-
Set up a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install dependencies:
pip install --upgrade pip pip install pytest
To run the application, execute the square_calculator.py
script:
python square_calculator.py
You will be prompted to enter a number, and the application will print the square of the entered number.
To run the tests using pytest
, execute the following command:
pytest test_square_calculator.py
This will run the test suite and provide a report of the test results.
The project includes a GitHub Actions workflow (.github/workflows/square_calculator.yml
) that automates the process of building, testing, and generating artifact attestations.
The workflow is triggered on workflow_dispatch
for demo purposes.