Skip to content

TestSQLApi/TestSQLApiConn::test_database_uri_string errors if pg8000 is installed #16527

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

Closed
neirbowj opened this issue May 28, 2017 · 1 comment · Fixed by #16528
Closed

TestSQLApi/TestSQLApiConn::test_database_uri_string errors if pg8000 is installed #16527

neirbowj opened this issue May 28, 2017 · 1 comment · Fixed by #16528
Labels
IO SQL to_sql, read_sql, read_sql_query
Milestone

Comments

@neirbowj
Copy link
Contributor

Code Sample, a copy-pastable example if possible

db_uri = "postgresql+pg8000://user:pass@host/dbname"
with tm.assert_raises_regex(ImportError, "pg8000"):
    sql.read_sql("select * from table", db_uri)

Problem description

The test code comments specify that pg8000 is a "driver that will not be installed on Travis". However, when the test suite is run elsewhere, that driver may be installed.

Expected Output

The test should pass or skip in any environment where pandas is expected to run successfully.

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 2.7.13.final.0 python-bits: 64 OS: FreeBSD OS-release: 10.3-STABLE machine: amd64 processor: amd64 byteorder: little LC_ALL: None LANG: None LOCALE: None.None

pandas: 0.20.1
pytest: 3.1.0
pip: None
setuptools: 32.1.0
Cython: 0.25.2
numpy: 1.11.2
scipy: 0.19.0
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: 1.0.0
tables: 3.4.2
numexpr: 2.6.2
feather: None
matplotlib: 1.5.3
openpyxl: 2.4.7
xlrd: 1.0.0
xlwt: 1.1.2
xlsxwriter: 0.9.6
lxml: 3.6.0
bs4: 4.5.1
html5lib: 0.9999999
sqlalchemy: 1.1.10
pymysql: 0.7.11.None
psycopg2: 2.7.1 (dt dec pq3 ext lo64)
jinja2: 2.9.5
s3fs: None
pandas_gbq: None
pandas_datareader: None

@neirbowj
Copy link
Contributor Author

I looked for a way to get SQLAlchemy to enumerate the currently supported drivers and came up dry. In order to skip this test less often, I think it would be necessary to hard code a list of known drivers, which would need to be maintained, try importing them in turn to find one that isn't installed, and skip only in the unlikely event that all drivers are available. That seemed out of proportion, so I elected to just skip if pg8000 is present.

@jreback jreback added the IO SQL to_sql, read_sql, read_sql_query label May 31, 2017
@jreback jreback added this to the 0.21.0 milestone May 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO SQL to_sql, read_sql, read_sql_query
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants