Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Run Unit Tests


on:
pull_request:
branches:
# GUYS ADD YOUR BRANCHES HERE:
- JasonWorking
- omarshakir8-UnitTestsDoc1
- omarshakir8-integration-testsdoc
# - [YOUR BRANCH HERE]
push:
branches:
- main
- JasonWorking # Runs automatically when changes are pushed to 'JasonWorking' branch. You should see a check mark or an 'X'!
- omarshakir8-UnitTestsDoc1
- omarshakir8-integration-testsdoc
# GUYS, ADD YOUR BRANCHES HERE:
# - [YOUR BRANCH HERE]


jobs:
test:
runs-on: ubuntu-latest


steps:
- name: Checkout code
uses: actions/checkout@v2


- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'


- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt # Install dependencies, including pytest


- name: Run tests
run: |
pytest --maxfail=1 --disable-warnings -q # Run pytest and fail after 1 failure
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions Feedstack/numbers_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def add_numbers(a, b):
return a + b
3 changes: 2 additions & 1 deletion Feedstack/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ python-dotenv
scikit-learn
nltk
seaborn
matplotlib
matplotlib
pytest
14 changes: 14 additions & 0 deletions Feedstack/unit_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pytest
from numbers_test import add_numbers


# Test function to check the addition of two numbers
def test_add_numbers():
assert add_numbers(2, 3) == 5 # Test 1: Should return 5
assert add_numbers(1, 1) == 2 # Test 2: Should return 2
assert add_numbers(0, 0) == 0 # Test 3: Should return 0
assert add_numbers(-1, 1) == 0 # Test 4: Should return 0
assert add_numbers(-2, -3) == -5 # Test 5: Should return -5


# To run the tests, run: pytest unit_test.py
Loading