From f7559d74936e7f1f92f28c1ac3fbf3eb7e0a7dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20V=2E=20Treider?= Date: Thu, 16 Nov 2023 11:22:15 +0100 Subject: [PATCH] fix failing doctest for workflow --- cognite/client/_api/workflows.py | 3 ++- tests/tests_unit/test_docstring_examples.py | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cognite/client/_api/workflows.py b/cognite/client/_api/workflows.py index 8351d86d90..e53f1c664c 100644 --- a/cognite/client/_api/workflows.py +++ b/cognite/client/_api/workflows.py @@ -187,8 +187,9 @@ def trigger( Trigger a workflow execution using a specific set of client credentials (i.e. not your current credentials): + >>> import os >>> from cognite.client.data_classes import ClientCredentials - >>> credentials = ClientCredentials("my-client-id", os.environ["MY_CLIENT_SECRET"]), + >>> credentials = ClientCredentials("my-client-id", os.environ["MY_CLIENT_SECRET"]) >>> res = c.workflows.executions.trigger("foo", "1", client_credentials=credentials) """ self._warning.warn() diff --git a/tests/tests_unit/test_docstring_examples.py b/tests/tests_unit/test_docstring_examples.py index 8a19ba1858..857bcb27c8 100644 --- a/tests/tests_unit/test_docstring_examples.py +++ b/tests/tests_unit/test_docstring_examples.py @@ -1,4 +1,5 @@ import doctest +from collections import defaultdict from unittest import TextTestRunner from unittest.mock import patch @@ -39,6 +40,7 @@ def run_docstring_tests(module): @patch("cognite.client.CogniteClient", CogniteClientMock) +@patch("os.environ", defaultdict(lambda: "value")) class TestDocstringExamples: def test_time_series(self): run_docstring_tests(time_series)