Skip to main content
Seasoned ⭐️⭐️
Oct 18, 2023 12:04 PM UTC
Solved

Unit testing for cognite extractors using pytest framework ---cogex based extractors

Hi Team,

 

IS there any unit testing examples for cogex based extractors to test integration with rest api

Andre Alves
MVP ⭐️⭐️⭐️⭐️⭐️
Oct 20, 2023 2:45 PM UTC

As mentioned by @mathialo , you can simply refer to the pytest documentation for guidance. However, if you're looking for some examples, you can explore the Cognite GitHub repositories. Below is a simple example of a validation unit test in the Cognite Python SDK:

https://github.com/cognitedata/cognite-sdk-python/blob/master/tests/tests_unit/test_utils/test_validation.py

André Alves

2 replies

Practitioner ⭐️⭐️⭐️
Oct 19, 2023 6:58 AM UTC

In terms of testing it’s just a normal python codebase, so there is nothing special you need to do. Just follow pytest’s documentation as normal.

Andre Alves
MVP ⭐️⭐️⭐️⭐️⭐️
MVP ⭐️⭐️⭐️⭐️⭐️
Oct 20, 2023 2:45 PM UTC

As mentioned by @mathialo , you can simply refer to the pytest documentation for guidance. However, if you're looking for some examples, you can explore the Cognite GitHub repositories. Below is a simple example of a validation unit test in the Cognite Python SDK:

https://github.com/cognitedata/cognite-sdk-python/blob/master/tests/tests_unit/test_utils/test_validation.py

André Alves