Repository: incubator-airflow Updated Branches: refs/heads/master 0da540bf7 -> 3e9c666e8
[AIRFLOW-1203] Pin Google API client version to fix OAuth issue Closes #2296 from criccomini/AIRFLOW-1203 Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/3e9c666e Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/3e9c666e Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/3e9c666e Branch: refs/heads/master Commit: 3e9c666e8e5643bb8d38fbc8bdb1ed8dee182ab2 Parents: 0da540b Author: Chris Riccomini <[email protected]> Authored: Mon May 15 14:42:09 2017 -0700 Committer: Chris Riccomini <[email protected]> Committed: Mon May 15 14:42:09 2017 -0700 ---------------------------------------------------------------------- scripts/ci/requirements.txt | 1 + tests/contrib/hooks/test_bigquery_hook.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/3e9c666e/scripts/ci/requirements.txt ---------------------------------------------------------------------- diff --git a/scripts/ci/requirements.txt b/scripts/ci/requirements.txt index 06ad0bb..ad02962 100644 --- a/scripts/ci/requirements.txt +++ b/scripts/ci/requirements.txt @@ -60,6 +60,7 @@ nose-exclude nose-ignore-docstring==0.2 nose-parameterized nose-timer +oauth2client>=2.0.2,<2.1.0 pandas pandas-gbq psutil>=4.2.0, <5.0.0 http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/3e9c666e/tests/contrib/hooks/test_bigquery_hook.py ---------------------------------------------------------------------- diff --git a/tests/contrib/hooks/test_bigquery_hook.py b/tests/contrib/hooks/test_bigquery_hook.py index ab946f0..9970d8d 100644 --- a/tests/contrib/hooks/test_bigquery_hook.py +++ b/tests/contrib/hooks/test_bigquery_hook.py @@ -16,31 +16,43 @@ import unittest from airflow.contrib.hooks import bigquery_hook as hook +from oauth2client.contrib.gce import HttpAccessTokenRefreshError +bq_available = True + +try: + hook.BigQueryHook().get_service() +except HttpAccessTokenRefreshError: + bq_available = False class TestBigQueryDataframeResults(unittest.TestCase): def setUp(self): self.instance = hook.BigQueryHook() + @unittest.skipIf(not bq_available, 'BQ is not available to run tests') def test_output_is_dataframe_with_valid_query(self): import pandas as pd df = self.instance.get_pandas_df('select 1') self.assertIsInstance(df, pd.DataFrame) + @unittest.skipIf(not bq_available, 'BQ is not available to run tests') def test_throws_exception_with_invalid_query(self): with self.assertRaises(Exception) as context: self.instance.get_pandas_df('from `1`') self.assertIn('pandas_gbq.gbq.GenericGBQException: Reason: invalidQuery', str(context.exception), "") + @unittest.skipIf(not bq_available, 'BQ is not available to run tests') def test_suceeds_with_explicit_legacy_query(self): df = self.instance.get_pandas_df('select 1', dialect='legacy') self.assertEqual(df.iloc(0)[0][0], 1) + @unittest.skipIf(not bq_available, 'BQ is not available to run tests') def test_suceeds_with_explicit_std_query(self): df = self.instance.get_pandas_df('select * except(b) from (select 1 a, 2 b)', dialect='standard') self.assertEqual(df.iloc(0)[0][0], 1) + @unittest.skipIf(not bq_available, 'BQ is not available to run tests') def test_throws_exception_with_incompatible_syntax(self): with self.assertRaises(Exception) as context: self.instance.get_pandas_df('select * except(b) from (select 1 a, 2 b)', dialect='legacy')
