From e22541b9e4ccf447be901a65260feae797b33a90 Mon Sep 17 00:00:00 2001 From: "John W. O'Brien" Date: Sun, 28 May 2017 16:00:57 -0400 Subject: [PATCH] TST: Skip test_database_uri_string if pg8000 importable --- pandas/tests/io/test_sql.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index 7b3717281bf89..23ec1ab820f8a 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -938,6 +938,13 @@ def test_database_uri_string(self): # using driver that will not be installed on Travis to trigger error # in sqlalchemy.create_engine -> test passing of this error to user + try: + # the rest of this test depends on pg8000's being absent + import pg8000 # noqa + pytest.skip("pg8000 is installed") + except ImportError: + pass + db_uri = "postgresql+pg8000://user:pass@host/dbname" with tm.assert_raises_regex(ImportError, "pg8000"): sql.read_sql("select * from table", db_uri)