File tree Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Expand file tree Collapse file tree 2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change 16
16
# fail-fast: true
17
17
# matrix:
18
18
# os: [ubuntu-latest]
19
- # # numpy-version: ['<1.19', '<1.20', '>=1.20']
20
19
# python-version: ['3.9', '3.10', '3.11', '3.12']
21
- # astropy -version: ['<6.0 ', '<6.1', '<7.0 ']
20
+ # airflow -version: ['<2.10 ', '<2.11 ']
22
21
23
22
# steps:
24
23
# - name: Checkout code
32
31
# - name: Install Python dependencies
33
32
# run: |
34
33
# python -m pip install --upgrade pip setuptools wheel
35
- # python -m pip install pytest pyyaml jinja2 numpy\<2.0
36
- # python -m pip install "astropy ${{ matrix.astropy -version }}"
34
+ # python -m pip install pytest
35
+ # python -m pip install "apache-airflow ${{ matrix.airflow -version }}"
37
36
# - name: Run the test
38
37
# run: pytest
39
38
45
44
matrix :
46
45
os : [ubuntu-latest]
47
46
python-version : ['3.9']
47
+ airflow-version : ['<2.10']
48
48
49
49
steps :
50
50
- name : Checkout code
59
59
run : |
60
60
python -m pip install --upgrade pip setuptools wheel
61
61
python -m pip install pytest pytest-cov coveralls
62
+ python -m pip install "apache-airflow${{ matrix.airflow-version }}"
62
63
- name : Run the test with coverage
63
64
run : pytest --cov
64
65
# - name: Coveralls
Original file line number Diff line number Diff line change
1
+ # Licensed under a BSD-style 3-clause license - see LICENSE.md.
2
+ # -*- coding: utf-8 -*-
3
+ """Test dlairflow.postgresql.
4
+ """
5
+ import os
6
+ from ..postgresql import pg_dump_schema , pg_restore_schema
7
+ from airflow .hooks .base import BaseHook
8
+
9
+
10
+ class MockConnection (object ):
11
+
12
+ def __init__ (self , connection ):
13
+ foo = connection .split (',' )
14
+ self .login = foo [0 ]
15
+ self .password = foo [1 ]
16
+ self .host = foo [2 ]
17
+ self .schema = foo [3 ]
18
+ return
19
+
20
+
21
+ def test_pg_dump_schema (monkeypatch ):
22
+ """Test pg_dump task.
23
+ """
24
+ def mock_connection (connection ):
25
+ conn = MockConnection (connection )
26
+ return conn
27
+
28
+ monkeypatch .setattr (BaseHook , "get_connection" , mock_connection )
29
+
30
+ test_operator = pg_dump_schema ("login,password,host,schema" )
31
+
32
+ print (dir (test_operator ))
You can’t perform that action at this time.
0 commit comments