I've found that entering/exiting context in the setUp/tearDown methods (as 
you do in your example) is adding about 0.7s to each of my tests, so I'm 
wondering how you're able to do 500 tests in 52s (works out to 0.1s per 
test). Perhaps it's machine dependent; I'm running these tests on a 2015 
MacBook Pro, so maybe they'd be faster on something newer.

On Saturday, February 29, 2020 at 8:22:35 PM UTC-8, Ryan B wrote:
>
> the datastore emulator is indeed slower than testbed for unit tests, but 
> just as another data point, it's not way too slow for me. i routinely use 
> it as part of my edit/compile/test loop on an app with a cumulative total 
> of >1600 tests. around 500 of them use the datastore heavily, and running 
> just those tests takes ~52s. not fast, but manageable, especially when i 
> iterate on just a few relevant tests, and then expand to all of them before 
> committing.
>
> also, you don't have to entirely tear down and restart the emulator just 
> to clear its data between tests. just POST to http://localhost:8089/reset 
> (or whichever port you run the emulator on). example: 
> https://github.com/snarfed/bridgy/blob/master/tests/testutil.py#L282-L289
>
>
> On Monday, February 24, 2020 at 1:05:33 PM UTC-8, Remko Tronçon wrote:
>>
>> On Monday, February 24, 2020 at 9:52:25 PM UTC+1, Andrew Gorcester wrote: 
>> > Cloud NDB is compatible with the Cloud Datastore Emulator; we recommend 
>> tests be done using that, the same way on Cloud NDB as they would be with 
>> the Cloud Datastore library. 
>>
>> Using an external emulator is way too slow to use for unit tests, even if 
>> you are able to get all your code changed so you don’ have to tear down and 
>> clean start the emulator to avoid interference between tests. This is 
>> pretty disappointing, and means I (and I expect many others) will be forced 
>> to rewrite everything if your app isn’t in pure maintenance mode. 
>>
>> Remko 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/eebf0a58-7be6-42b9-8a50-e0e11091b6c5%40googlegroups.com.

Reply via email to