Skip to content

Commit

Permalink
test with airflow
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Dec 13, 2024
1 parent 49d522a commit 377817b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ jobs:
# fail-fast: true
# matrix:
# os: [ubuntu-latest]
# # numpy-version: ['<1.19', '<1.20', '>=1.20']
# python-version: ['3.9', '3.10', '3.11', '3.12']
# astropy-version: ['<6.0', '<6.1', '<7.0']
# airflow-version: ['<2.10', '<2.11']

# steps:
# - name: Checkout code
Expand All @@ -32,8 +31,8 @@ jobs:
# - name: Install Python dependencies
# run: |
# python -m pip install --upgrade pip setuptools wheel
# python -m pip install pytest pyyaml jinja2 numpy\<2.0
# python -m pip install "astropy${{ matrix.astropy-version }}"
# python -m pip install pytest
# python -m pip install "apache-airflow${{ matrix.airflow-version }}"
# - name: Run the test
# run: pytest

Expand All @@ -45,6 +44,7 @@ jobs:
matrix:
os: [ubuntu-latest]
python-version: ['3.9']
airflow-version: ['<2.10']

steps:
- name: Checkout code
Expand All @@ -59,6 +59,7 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install pytest pytest-cov coveralls
python -m pip install "apache-airflow${{ matrix.airflow-version }}"
- name: Run the test with coverage
run: pytest --cov
# - name: Coveralls
Expand Down
32 changes: 32 additions & 0 deletions dlairflow/test/test_postgresql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Licensed under a BSD-style 3-clause license - see LICENSE.md.
# -*- coding: utf-8 -*-
"""Test dlairflow.postgresql.
"""
import os
from ..postgresql import pg_dump_schema, pg_restore_schema
from airflow.hooks.base import BaseHook


class MockConnection(object):

def __init__(self, connection):
foo = connection.split(',')
self.login = foo[0]
self.password = foo[1]
self.host = foo[2]
self.schema = foo[3]
return


def test_pg_dump_schema(monkeypatch):
"""Test pg_dump task.
"""
def mock_connection(connection):
conn = MockConnection(connection)
return conn

monkeypatch.setattr(BaseHook, "get_connection", mock_connection)

test_operator = pg_dump_schema("login,password,host,schema")

print(dir(test_operator))

0 comments on commit 377817b

Please sign in to comment.