Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you unit test Google Cloud NDB code?

The recommended path for upgrading a Python 2 AppEngine app to the new runtime is to switch datastore code to Google Cloud NDB. However, I can't find anything about unit testing code that uses Cloud NDB (which was previously possible using the Python 2 testbed library).

How can Cloud NDB code be unit tested? (apart from standard abstracting the Cloud NDB dependency yourself)

like image 580
Remko Avatar asked Feb 22 '20 10:02

Remko


People also ask

What is cloud NDB?

App Engine NDB enables Python 2 apps to store and query data in Datastore databases. Cloud NDB enables Python 2 and Python 3 apps to store and query data in the same databases, however the product that manages those databases has changed from Datastore to Firestore in Datastore mode (Datastore).

Why write unit tests?

They enable you to catch bugs early in the development process. Automated unit tests help a great deal with regression testing. They detect code smells in your codebase. For example, if you're having a hard time writing unit tests for a piece of code, it might be a sign that your function is too complex.


1 Answers

Apparently, there is no way to unit test Cloud NDB code anymore. The only testing solution available is the Cloud Datastore Emulator.

like image 131
Remko Avatar answered Oct 12 '22 23:10

Remko