File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed
Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CI Pipeline # The name of the workflow
2+
3+ on : # Events that trigger this workflow
4+ push : # Runs when code is pushed
5+ branches :
6+ - main
7+ pull_request : # Runs when a PR is created
8+ branches :
9+ - main
10+
11+ jobs :
12+ test : # Define a job named 'test'
13+ runs-on : ubuntu-latest # The OS where the job runs
14+
15+ steps :
16+ - name : Checkout code # Step 1: Get the repository code
17+ uses : actions/checkout@v3
18+
19+ - name : Set up Python # Step 2: Install Python
20+ uses : actions/setup-python@v4
21+ with :
22+ python-version : 3.9 # Change if you need a different version
23+
24+ - name : Install dependencies # Step 3: Install required packages
25+ run : |
26+ python -m venv venv # Create a virtual environment
27+ source venv/bin/activate # Activate virtual environment
28+ pip install -r requirements.txt # Install dependencies
29+
30+ - name : Run tests # Step 4: Execute tests
31+ run : |
32+ source venv/bin/activate
33+ pytest
Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ Jinja2==3.1.2
44click == 8.1.7
55itsdangerous == 2.1.2
66MarkupSafe == 2.1.3
7+ pytest
Original file line number Diff line number Diff line change 1+ import pytest
2+ from app import app
3+
4+ @pytest .fixture
5+ def client ():
6+ app .config ["TESTING" ] = True
7+ with app .test_client () as client :
8+ yield client
9+
10+ def test_home_page (client ):
11+ response = client .get ("/" )
12+ assert response .status_code == 200
13+ assert b"Welcome to Flask!" in response .data
You can’t perform that action at this time.
0 commit comments