question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cleanup @cocotb.test(expect_error=True)

See original GitHub issue

#2107 revealed how expect_error=True can mask a problem, because any Exception raised by the test will mark it as PASS.

This test passes even though the wrong error is causing the failure:

https://github.com/cocotb/cocotb/blob/89e7bd77b1e9ceb3172b4659e267bc4c42217a0f/tests/test_cases/test_discovery/test_discovery.py#L101-L106

These tests should be cleaned up to use assert_raises style or provide the expected Exception type.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
marlonjamescommented, Oct 10, 2020

@markusdd There are other uses that should be modified. The test from #2107 is mentioned as the motivating example that showed how using True instead of the expected Exception type can lead to an inadvertent PASS. The point of this issue is to investigate the uses of expect_error=True and be more explicit where it makes sense to do so.

1reaction
markusddcommented, Oct 9, 2020

This test is a duplicate or very similar to what is done in test_handle.py

We agreed to merge/move/remove this in PR #2107

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found