Skip to content

Conversation

@wchargin
Copy link
Contributor

Summary:
Some of the //tensorboard/uploader/... tests are currently disabled in
Python 2 because our backport of mock doesn’t support the required
assertions. We can’t easily upgrade the dependency (see #2132), but we
can backport those assertions. The assertions backported are:

  • assert_not_called
  • assert_called
  • assert_called_once

This patch is the combination of (restrictions of) the following
upstream Git commits:

I identified those commits by diffing our pinned version of mock.py
(the version at upstream commits b14e284 through dc1458a) against
the version of mock/mock.py in the current repo, tracing the blame on
the implementation of the relevant assertions, then pruning commits that
relied on other changes not yet patched in (and were only cosmetic,
anyway
).

Test Plan:
Unit tests pass in Python 2, and are now actually run, too. Changing
uploader_test.py’s test_upload_swallows_rpc_failure to comment out
the _upload_once call causes the subsequent assert_called_once to
fail with the correct error message, showing that the assertions are
wired up properly.

wchargin-branch: mock-backport

Summary:
Some of the `//tensorboard/uploader/...` tests are currently disabled in
Python 2 because our backport of `mock` doesn’t support the required
assertions. We can’t easily upgrade the dependency (see #2132), but we
can backport those assertions. The assertions backported are:

  - `assert_not_called`
  - `assert_called`
  - `assert_called_once`

This patch is the combination of (restrictions of) the following
upstream Git commits:

  - [`c7d6c7dcafd4482626194528b24f174dd15f5f5e`][1] (2014-04-17)
  - [`8882c2fccb9f7d3b8ba2b5534c0dd9d52343725f`][2] (2014-04-17)
  - [`7ca5d3afe293d5e4d769c1cb2dfccb0688ba1292`][3] (2016-03-11)
  - [`07532a75003ec8e871e494f9f1ab8f28fa246f08`][4] (2018-01-19)

I identified those commits by diffing our pinned version of `mock.py`
(the version at upstream commits `b14e284` through `dc1458a`) against
the version of `mock/mock.py` in the current repo, tracing the blame on
the implementation of the relevant assertions, then pruning commits that
relied on other changes not yet patched in (and were [only cosmetic,
anyway][5]).

[1]: testing-cabal/mock@c7d6c7d
[2]: testing-cabal/mock@8882c2f
[3]: testing-cabal/mock@7ca5d3a
[4]: testing-cabal/mock@07532a7
[5]: testing-cabal/mock@57ef3bb

Test Plan:
Unit tests pass in Python 2, and are now actually run, too. Changing
`uploader_test.py`’s `test_upload_swallows_rpc_failure` to comment out
the `_upload_once` call causes the subsequent `assert_called_once` to
fail with the correct error message, showing that the assertions are
wired up properly.

wchargin-branch: mock-backport
@wchargin wchargin merged commit e8661cd into master Oct 25, 2019
@wchargin wchargin deleted the wchargin-mock-backport branch October 25, 2019 07:21
wchargin added a commit to wchargin/tensorboard that referenced this pull request Oct 29, 2019
Summary:
Some of the `//tensorboard/uploader/...` tests are currently disabled in
Python 2 because our backport of `mock` doesn’t support the required
assertions. We can’t easily upgrade the dependency (see tensorflow#2132), but we
can backport those assertions. The assertions backported are:

  - `assert_not_called`
  - `assert_called`
  - `assert_called_once`

This patch is the combination of (restrictions of) the following
upstream Git commits:

  - [`c7d6c7dcafd4482626194528b24f174dd15f5f5e`][1] (2014-04-17)
  - [`8882c2fccb9f7d3b8ba2b5534c0dd9d52343725f`][2] (2014-04-17)
  - [`7ca5d3afe293d5e4d769c1cb2dfccb0688ba1292`][3] (2016-03-11)
  - [`07532a75003ec8e871e494f9f1ab8f28fa246f08`][4] (2018-01-19)

I identified those commits by diffing our pinned version of `mock.py`
(the version at upstream commits `b14e284` through `dc1458a`) against
the version of `mock/mock.py` in the current repo, tracing the blame on
the implementation of the relevant assertions, then pruning commits that
relied on other changes not yet patched in (and were [only cosmetic,
anyway][5]).

[1]: testing-cabal/mock@c7d6c7d
[2]: testing-cabal/mock@8882c2f
[3]: testing-cabal/mock@7ca5d3a
[4]: testing-cabal/mock@07532a7
[5]: testing-cabal/mock@57ef3bb

Test Plan:
Unit tests pass in Python 2, and are now actually run, too. Changing
`uploader_test.py`’s `test_upload_swallows_rpc_failure` to comment out
the `_upload_once` call causes the subsequent `assert_called_once` to
fail with the correct error message, showing that the assertions are
wired up properly.

wchargin-branch: mock-backport
@wchargin wchargin mentioned this pull request Oct 29, 2019
wchargin added a commit that referenced this pull request Oct 29, 2019
Summary:
Some of the `//tensorboard/uploader/...` tests are currently disabled in
Python 2 because our backport of `mock` doesn’t support the required
assertions. We can’t easily upgrade the dependency (see #2132), but we
can backport those assertions. The assertions backported are:

  - `assert_not_called`
  - `assert_called`
  - `assert_called_once`

This patch is the combination of (restrictions of) the following
upstream Git commits:

  - [`c7d6c7dcafd4482626194528b24f174dd15f5f5e`][1] (2014-04-17)
  - [`8882c2fccb9f7d3b8ba2b5534c0dd9d52343725f`][2] (2014-04-17)
  - [`7ca5d3afe293d5e4d769c1cb2dfccb0688ba1292`][3] (2016-03-11)
  - [`07532a75003ec8e871e494f9f1ab8f28fa246f08`][4] (2018-01-19)

I identified those commits by diffing our pinned version of `mock.py`
(the version at upstream commits `b14e284` through `dc1458a`) against
the version of `mock/mock.py` in the current repo, tracing the blame on
the implementation of the relevant assertions, then pruning commits that
relied on other changes not yet patched in (and were [only cosmetic,
anyway][5]).

[1]: testing-cabal/mock@c7d6c7d
[2]: testing-cabal/mock@8882c2f
[3]: testing-cabal/mock@7ca5d3a
[4]: testing-cabal/mock@07532a7
[5]: testing-cabal/mock@57ef3bb

Test Plan:
Unit tests pass in Python 2, and are now actually run, too. Changing
`uploader_test.py`’s `test_upload_swallows_rpc_failure` to comment out
the `_upload_once` call causes the subsequent `assert_called_once` to
fail with the correct error message, showing that the assertions are
wired up properly.

wchargin-branch: mock-backport
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants