Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix dags tests to work with explicit import paths #506

Merged
merged 1 commit into from
Aug 25, 2023
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/dags_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r dags/requirements.txt
pip install apache-airflow boto3
pip check
- name: Lint dags with ruff
run: |
pip install ruff
ruff check --format=github ./dags
- name: Test with Pytest
run: |
pip install pytest apache-airflow
cd dags || exit
pytest tests.py -v
pip install pytest
pytest dags_tests.py -v
1 change: 1 addition & 0 deletions dags/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.5.1/constraints-3.10.txt"
requests
sickle
python-dotenv
6 changes: 5 additions & 1 deletion dags/tests.py → dags_tests.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import sys

from unittest import TestCase

from airflow.models import DagBag

sys.path.append('.')

DAGS_FOLDER = "."
DAGS_FOLDER = "./dags/"


class HarvestDagsTest(TestCase):
Expand All @@ -12,3 +15,4 @@ def dag_bag(self):

def test_no_import_errors(self):
assert not self.dag_bag().import_errors