laughingman7743 / PyAthena

PyAthena is a Python DB API 2.0 (PEP 249) client for Amazon Athena.
MIT License
463 stars 105 forks source link

fix(reuse): :bug: convert reuse parameters to the expected data type #478

Closed CandiedCode closed 1 year ago

CandiedCode commented 1 year ago

This resolves https://github.com/laughingman7743/PyAthena/issues/477

This passed in the expected values

Screenshot 2023-10-11 at 9 00 45 AM
laughingman7743 commented 1 year ago
============================================================================================================================================================================================================================ short test summary info =============================================================================================================================================================================================================================
FAILED tests/pyathena/sqlalchemy/test_base.py::TestSQLAlchemyAthena::test_conn_str_result_reuse_enable[engine0] - assert False
FAILED tests/pyathena/sqlalchemy/test_base.py::TestSQLAlchemyAthena::test_conn_str_result_reuse_minutes[engine0] - assert 60 == 10
============================================================================================================================================================================================================= 2 failed, 486 passed, 61 warnings in 328.28s (0:05:28) =============================================================================================================================================================================================================
make: *** [test] Error 1

I get an error in the test. Perhaps you need to add result_reuse_enable and result_reuse_minutes to the args list below. https://github.com/laughingman7743/PyAthena/blob/master/tests/pyathena/conftest.py#L78-L91

CandiedCode commented 1 year ago

@laughingman7743 I alphabetized the arg list and added the 2 missing ones.

laughingman7743 commented 1 year ago
$ make test                                                                                                                                                                                                                                                                                                                                                      4960ms  Thu Oct 12 01:32:01 2023
# https://github.com/PyCQA/flake8/issues/234
poetry run flake8 --max-line-length 100 --exclude .poetry,.tox,.tmp .
Configuration file exists at /Users/foobar/Library/Preferences/pypoetry, reusing this directory.

Consider moving TOML configuration files to /Users/foobar/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
poetry run isort -c .
Configuration file exists at /Users/foobar/Library/Preferences/pypoetry, reusing this directory.

Consider moving TOML configuration files to /Users/foobar/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
Skipped 3 files
poetry run black --check --diff .
Configuration file exists at /Users/foobar/Library/Preferences/pypoetry, reusing this directory.

Consider moving TOML configuration files to /Users/foobar/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
All done! ✨ 🍰 ✨
73 files would be left unchanged.
poetry run mypy .
Configuration file exists at /Users/foobar/Library/Preferences/pypoetry, reusing this directory.

Consider moving TOML configuration files to /Users/foobar/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
Success: no issues found in 36 source files
poetry run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/pyathena/
Configuration file exists at /Users/foobar/Library/Preferences/pypoetry, reusing this directory.

Consider moving TOML configuration files to /Users/foobar/Library/Application Support/pypoetry, as support for the legacy directory will be removed in an upcoming release.
============================================================================================================================================================================================================================== test session starts ===============================================================================================================================================================================================================================
platform darwin -- Python 3.11.2, pytest-7.4.1, pluggy-1.3.0
rootdir: /Users/foobar/github/PyAthena
configfile: pyproject.toml
plugins: cov-4.1.0, xdist-3.3.1
8 workers [488 items]   
.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................... [ 93%]
..............................                                                                                                                                                                                                                                                                                                                                                                                                                                             [100%]
================================================================================================================================================================================================================================ warnings summary ================================================================================================================================================================================================================================
tests/pyathena/sqlalchemy/test_base.py: 61 warnings
  /Users/foobar/github/PyAthena/tests/pyathena/conftest.py:96: SADeprecationWarning: The dbapi() classmethod on dialect classes has been renamed to import_dbapi().  Implement an import_dbapi() classmethod directly on class <class 'pyathena.sqlalchemy.rest.AthenaRestDialect'> to remove this warning; the old .dbapi() classmethod may be maintained for backwards compatibility.
    return sqlalchemy.engine.create_engine(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

---------- coverage: platform darwin, python 3.11.2-final-0 ----------
Name                                  Stmts   Miss  Cover
---------------------------------------------------------
pyathena/__init__.py                     36      6    83%
pyathena/arrow/__init__.py                0      0   100%
pyathena/arrow/async_cursor.py           47      1    98%
pyathena/arrow/converter.py              32      2    94%
pyathena/arrow/cursor.py                 94      2    98%
pyathena/arrow/result_set.py            148     14    91%
pyathena/arrow/util.py                   45      3    93%
pyathena/async_cursor.py                 59      2    97%
pyathena/common.py                      260     37    86%
pyathena/connection.py                  114     28    75%
pyathena/converter.py                    81      9    89%
pyathena/cursor.py                       77      2    97%
pyathena/error.py                        21      0   100%
pyathena/fastparquet/__init__.py          0      0   100%
pyathena/fastparquet/util.py             44      3    93%
pyathena/filesystem/__init__.py           0      0   100%
pyathena/filesystem/s3.py               279     74    73%
pyathena/filesystem/s3_object.py         34      0   100%
pyathena/formatter.py                    99      5    95%
pyathena/model.py                       369      8    98%
pyathena/pandas/__init__.py               3      0   100%
pyathena/pandas/async_cursor.py          49      1    98%
pyathena/pandas/converter.py             23      0   100%
pyathena/pandas/cursor.py               101      2    98%
pyathena/pandas/result_set.py           230     26    89%
pyathena/pandas/util.py                 155      6    96%
pyathena/result_set.py                  556    107    81%
pyathena/sqlalchemy/__init__.py           0      0   100%
pyathena/sqlalchemy/arrow.py             15     15     0%
pyathena/sqlalchemy/base.py             501     72    86%
pyathena/sqlalchemy/pandas.py            19     19     0%
pyathena/sqlalchemy/requirements.py      95     95     0%
pyathena/sqlalchemy/rest.py               4      0   100%
pyathena/sqlalchemy/types.py             26      9    65%
pyathena/sqlalchemy/util.py               3      1    67%
pyathena/util.py                         31      1    97%
---------------------------------------------------------
TOTAL                                  3650    550    85%
Coverage HTML written to dir htmlcov

================================================================================================================================================================================================================== 488 passed, 61 warnings in 300.37s (0:05:00) ==================================================================================================================================================================================================================

laughingman7743 commented 1 year ago

Thank you for your contribution!

laughingman7743 commented 1 year ago

v3.0.9 has been released. 🎉 https://github.com/laughingman7743/PyAthena/releases/tag/v3.0.9 https://pypi.org/project/PyAthena/3.0.9/