Allow assert_warns to match against multiple warnings.

Review Request #10774 — Created Nov. 1, 2019 and submitted

chipx86
Review Board
release-4.0.x
2f8e2eb...
reviewboard

Our TestCase.assert_warns method only worked when a single warning was
being emitted by code. There wasn't much reason for this, besides of
ease of implementation, and it made unit tests more fragile.

This change updates the function to check the provided warning
information against all emitted warnings, looking for a match. If none
are found, this will fail with an explicit error message.

Unit tests pass.

Made use of this in an upcoming unit test, which has to deal with multiple
warnings. It passed.

david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (404d74d)
Loading...