Skip to content
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

'TestClient.test_constructor_w_implicit_inputs' unit test failure #53

Closed
tseaver opened this issue Aug 5, 2020 · 0 comments · Fixed by #54
Closed

'TestClient.test_constructor_w_implicit_inputs' unit test failure #53

tseaver opened this issue Aug 5, 2020 · 0 comments · Fixed by #54
Assignees
Labels
api: datastore Issues related to the googleapis/python-datastore API. priority: p0 Highest priority. Critical issue. P0 implies highest priority. testing type: process A process-related concern. May include testing, release, or the like.

Comments

@tseaver
Copy link
Contributor

tseaver commented Aug 5, 2020

From this Kokoro build failure:

________________ TestClient.test_constructor_w_implicit_inputs _________________

self = <tests.unit.test_client.TestClient testMethod=test_constructor_w_implicit_inputs>

    def test_constructor_w_implicit_inputs(self):
        from google.cloud.datastore.client import _CLIENT_INFO
        from google.cloud.datastore.client import _DATASTORE_BASE_URL

        other = "other"
        creds = _make_credentials()

        klass = self._get_target_class()
        patch1 = mock.patch(
            "google.cloud.datastore.client._determine_default_project",
            return_value=other,
        )
        patch2 = mock.patch("google.auth.default", return_value=(creds, None))

        with patch1 as _determine_default_project:
            with patch2 as default:
                client = klass()

        self.assertEqual(client.project, other)
        self.assertIsNone(client.namespace)
        self.assertIs(client._credentials, creds)
        self.assertIs(client._client_info, _CLIENT_INFO)
        self.assertIsNone(client._http_internal)
        self.assertIsNone(client._client_options)
        self.assertEqual(client.base_url, _DATASTORE_BASE_URL)

        self.assertIsNone(client.current_batch)
        self.assertIsNone(client.current_transaction)

>       default.assert_called_once_with()

tests/unit/test_client.py:183:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.nox/unit-2-7/lib/python2.7/site-packages/mock/mock.py:957: in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
.nox/unit-2-7/lib/python2.7/site-packages/mock/mock.py:944: in assert_called_with
    six.raise_from(AssertionError(_error_message(cause)), cause)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

value = AssertionError("expected call not found.\nExpected: default()\nActual: default(scopes=('https://www.googleapis.com/auth/datastore',))",)
from_value = None

    def raise_from(value, from_value):
>       raise value
E       AssertionError: expected call not found.
E       Expected: default()
E       Actual: default(scopes=('https://www.googleapis.com/auth/datastore',))
@tseaver tseaver added type: process A process-related concern. May include testing, release, or the like. priority: p0 Highest priority. Critical issue. P0 implies highest priority. testing labels Aug 5, 2020
@tseaver tseaver self-assigned this Aug 5, 2020
@product-auto-label product-auto-label bot added the api: datastore Issues related to the googleapis/python-datastore API. label Aug 5, 2020
tseaver added a commit that referenced this issue Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/python-datastore API. priority: p0 Highest priority. Critical issue. P0 implies highest priority. testing type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant