SalAlba opened a new pull request #10864:
URL: https://github.com/apache/airflow/pull/10864


   
   This PR is about increasing typing coverage for the postgres provider. Part 
of: #9708
   
   I change this file airflow/providers/postgres/hooks/postgres.py
   
   closes: #9943
   related: #9708
   
   ---
   I go throw this guideline [Step 4: Prepare 
PR](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#step-4-prepare-pr)
   
   
   ## [Run the unit tests from the IDE or local virtualenv as you see 
fit.](https://github.com/apache/airflow/blob/master/TESTING.rst#running-unit-tests)
   
   run the command bellow
   
   ``` bash
   $ pytest tests/providers/postgres/
   ```
   result
   
   ``` bash
   ============================================================ test session 
starts =============================================================
   platform linux -- Python 3.7.0, pytest-6.0.1, py-1.9.0, pluggy-0.13.1 -- 
/home/salem/.pyenv/versions/3.7.0/envs/airflow-venv-370/bin/python3.7
   cachedir: .pytest_cache
   rootdir: /home/salem/WorkSpaces/python/airflow, configfile: pytest.ini
   plugins: rerunfailures-9.0, forked-1.3.0, flaky-3.7.0, cov-2.10.1, 
requests-mock-1.8.0, timeouts-1.2.1, instafail-0.4.2, xdist-2.0.0
   setup timeout: 0.0s, execution timeout: 0.0s, teardown timeout: 0.0s
   collected 20 items                    
   
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn
 PASSED                                            [  5%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_cursor
 PASSED                                     [ 10%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_from_connection
 PASSED                            [ 15%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_from_connection_with_schema
 PASSED                [ 20%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_non_default_id
 PASSED                             [ 25%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_rds_iam_postgres
 PASSED                           [ 30%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_rds_iam_redshift
 PASSED                           [ 35%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_with_invalid_cursor
 PASSED                        [ 40%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHook::test_bulk_dump
 SKIPPED                                              [ 45%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHook::test_bulk_load
 SKIPPED                                              [ 50%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHook::test_copy_expert
 SKIPPED                                            [ 55%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHook::test_insert_rows
 SKIPPED                                            [ 60%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHook::test_insert_rows_replace
 SKIPPED                                    [ 65%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHook::test_insert_rows_replace_missing_replace_index_arg
 SKIPPED          [ 70%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHook::test_insert_rows_replace_missing_target_field_arg
 SKIPPED           [ 75%]
   
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHook::test_rowcount
 SKIPPED                                               [ 80%]
   
tests/providers/postgres/operators/test_postgres.py::TestPostgres::test_overwrite_schema
 SKIPPED                                       [ 85%]
   
tests/providers/postgres/operators/test_postgres.py::TestPostgres::test_postgres_operator_test
 SKIPPED                                 [ 90%]
   
tests/providers/postgres/operators/test_postgres.py::TestPostgres::test_postgres_operator_test_multi
 SKIPPED                           [ 95%]
   
tests/providers/postgres/operators/test_postgres.py::TestPostgres::test_vacuum 
SKIPPED                                                 [100%]
   ============================================================== warnings 
summary ==============================================================
   ================================================== 8 passed, 12 skipped, 1 
warning in 0.91s ==================================================
   ``` 
   
   ## [Run the tests in 
Breeze.](https://github.com/apache/airflow/blob/master/TESTING.rst#running-tests-for-a-specified-target-using-breeze-from-the-host)
   
   run the command bellow
   
   ``` bash
   $ sudo ./breeze tests tests/providers/postgres
   ```
   
   results
   
   ``` bash
   ============================================================== warnings 
summary ==============================================================
   ERROR 
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn
 - Failed: Timeout >10.0s
   ERROR 
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_cursor
 - Failed: Timeout >10.0s
   ERROR 
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_from_connection
 - Failed: Timeout >10.0s
   ERROR 
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_from_connection_with_schema
 - Failed: Timeout >1...
   ERROR 
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_non_default_id
 - Failed: Timeout >10.0s
   ERROR 
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_rds_iam_postgres
 - Failed: Timeout >10.0s
   ERROR 
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_rds_iam_redshift
 - Failed: Timeout >10.0s
   ERROR 
tests/providers/postgres/hooks/test_postgres.py::TestPostgresHookConn::test_get_conn_with_invalid_cursor
 - Failed: Timeout >10.0s
   ================================================= 12 skipped, 2 warnings, 8 
errors in 15.06s =================================================
   
   Regular tests. NOT Updating Quarantine Issue!
   
   ```
   
   ## [Running static 
checks](https://github.com/apache/airflow/blob/master/BREEZE.rst#running-static-checks)
   
   I don't know at this time which static test should run for this Issue but I 
used the default one as shown below
   
   ``` bash
   sudo ./breeze static-check mypy
   ```
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)**
 for more information.
   In case of fundamental code change, Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in 
[UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to