|
43 | 43 | from google.auth.exceptions import MutualTLSChannelError |
44 | 44 | import google_auth_httplib2 |
45 | 45 | import httplib2 |
46 | | -from oauth2client import GOOGLE_TOKEN_URI |
47 | | -from oauth2client.client import GoogleCredentials, OAuth2Credentials |
48 | 46 | from parameterized import parameterized |
49 | 47 | import uritemplate |
50 | 48 |
|
| 49 | +try: |
| 50 | + from oauth2client import GOOGLE_TOKEN_URI |
| 51 | + from oauth2client.client import GoogleCredentials, OAuth2Credentials |
| 52 | + |
| 53 | + HAS_OAUTH2CLIENT = True |
| 54 | +except ImportError: |
| 55 | + HAS_OAUTH2CLIENT = False |
| 56 | + |
51 | 57 | from googleapiclient import _helpers as util |
52 | 58 | from googleapiclient.discovery import ( |
53 | 59 | DISCOVERY_URI, |
@@ -1513,6 +1519,7 @@ def test_plus_resources(self): |
1513 | 1519 | self.assertTrue(getattr(plus, "activities")) |
1514 | 1520 | self.assertTrue(getattr(plus, "people")) |
1515 | 1521 |
|
| 1522 | + @unittest.skipIf(not HAS_OAUTH2CLIENT, "oauth2client unavailable.") |
1516 | 1523 | def test_oauth2client_credentials(self): |
1517 | 1524 | credentials = mock.Mock(spec=GoogleCredentials) |
1518 | 1525 | credentials.create_scoped_required.return_value = False |
@@ -2198,6 +2205,7 @@ def _dummy_token(self): |
2198 | 2205 | user_agent, |
2199 | 2206 | ) |
2200 | 2207 |
|
| 2208 | + @unittest.skipIf(not HAS_OAUTH2CLIENT, "oauth2client unavailable.") |
2201 | 2209 | def test_pickle_with_credentials(self): |
2202 | 2210 | credentials = self._dummy_token() |
2203 | 2211 | http = self._dummy_zoo_request() |
|
0 commit comments