New issue
Advanced search Search tips

Issue 918754 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Jan 5
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

assert_not_called and assert_called_once don't work in chromium

Project Member Reported by ntfschr@chromium.org, Jan 3

Issue description

See issue 878777 for details. TL;DR chromium's pymock is very old, and it treats assert_not_called() and assert_called_once as methods it should mock out (and so calling them is a NOOP).

I'll use this ticket to track fixing the tests I've written/am aware of.
 
I stumbled across that issue, and although IIRC I solved it much like Egor did, I also found this: http://engineroom.trackmaven.com/blog/mocking-mistakes/ which might point at a better way (although I didn't try it)
Sent a CL for downstream. I can't find any mistakes I've added upstream.

Other (possible) instances: https://cs.chromium.org/search/?q=lang:py+%5Cbassert_(not_called%7Ccalled_once)%5Cb+-f:third_party/catapult/&sq=package:chromium&type=cs (I exclude catapult/ because it has its own mock.py in third_party/).
I can't run any of the other python files (python fails quickly because it can't find the "mock" module). So, I'll assume those authors know what they're doing.
Project Member

Comment 4 by bugdroid1@chromium.org, Jan 5

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/clank/internal/apps/+/81a91eb1f23e419b5a3b53278fd3a402a732ed33

commit 81a91eb1f23e419b5a3b53278fd3a402a732ed33
Author: Nate Fischer <ntfschr@google.com>
Date: Sat Jan 05 00:21:52 2019

Status: Verified (was: Assigned)
Closing out because I'm not sure how to fix the other files. No manual verification necessary.

Sign in to add a comment