tgoop.com/pyproglib/5899
Create:
Last Update:
Last Update:
Настроим автоматическое выполнение тестов каждый раз при обновлении кода.
pip install pytest
# test_sample.py
# A simple test to check if the sum function works correctly
def test_sum():
assert sum([1, 2, 3]) == 6, "Sum function did not return the expected result"
Создайте файл .github/workflows/python-app.yml с содержимым:
name: Python application
# This triggers the workflow on every push or pull request to the main branch
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x' # Specify the Python version you want to use
- name: Install dependencies
run: |
pip install pytest
- name: Run tests
run: |
pytest