Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnestaP committed Feb 22, 2024
1 parent d1ce962 commit a393f34
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/run-pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Python application test with pytest
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build_test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v3

- name: Checkout PR
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Install Python 3
uses: actions/setup-python@v4
with:
python-version: 3.10.11

- name: Install python dependencies
run: |
pip install --upgrade pip
pip install --no-cache-dir --upgrade setuptools
pip install --no-cache-dir --upgrade wheel
pip install -r requirements.txt
- name: Test with pytest
run: pytest
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ ENV AIRFLOW__LOGGING__LOGGING_LEVEL=INFO

# install your pip packages
COPY requirements.txt ./requirements.txt
COPY requirements-test.txt ./requirements-test.txt

COPY dags ./dags
COPY airflow.cfg ./airflow.cfg

RUN pip install --upgrade pip &&\
pip install --no-cache-dir --upgrade setuptools==59.1.1 &&\
pip install --no-cache-dir --upgrade wheel &&\
pip install --no-cache-dir --user -r requirements.txt
pip install --no-cache-dir --user -r requirements-test.txt -r requirements.txt
9 changes: 9 additions & 0 deletions tests/unit/test_test_dag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from dags.test.test_dag import fetch, pull


def test_test_dag_fetch():
assert fetch() == "Test String"


def test_test_dag_pull():
assert pull("Test String") == "Test String"

0 comments on commit a393f34

Please sign in to comment.