Closed Bug 1714684 Opened 4 years ago Closed 4 years ago

remove "mock-1.0.0" vendored library

Categories

(Firefox Build System :: Mach Core, task)

task

Tracking

(firefox91 fixed)

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: mhentges, Assigned: mhentges)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

We have unittest.mock in Python 3, let's use that instead.

Assignee: nobody → mhentges
Status: NEW → ASSIGNED
Blocks: goodbye-py2

Python 3 has access to unittest.mock in the standard library.

Depends on D117072

The calls parameter is expected to be an iterable
container of calls, not a singular call.

This was working in mock-1.0.0 because calls
was (confusingly) allowed to be a single item
if any_order==False. This behaviour isn't
the same in th standard library.

Depends on D117073

In the vendored mock library, assert_called() returns the
MagicMock instance again - I'm not sure that it does the actual
assertion, so assert instance.is_called() may be a no-op.

Fortunately, in unittest.mock, assert_called() does the assertion
internally, and returns None. Since assert None causes a failure,
we need to tweak the invalid usage accordingly.

Depends on D117074

Pushed by mhentges@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f7970286ea6a Remove usages of vendored "mock" library r=perftest-reviewers,ahal,sparky https://hg.mozilla.org/integration/autoland/rev/cf4fe27bad4e Resolve `assert_has_calls()` usage error r=ahal https://hg.mozilla.org/integration/autoland/rev/fd0fdbf27acd Don't `assert` the result of `assert_called()` r=perftest-reviewers,AlexandruIonescu https://hg.mozilla.org/integration/autoland/rev/0dad88dc18d6 Remove unused "mock" vendored library r=ahal
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: