Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prepare tests and disable warnings for asyncio unittest cases
shoehorn unittest async results into python test result interpretation changelog
- Loading branch information
1 parent
1d244b3
commit e216752
Showing
5 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pytest] | ||
# dummy pytest.ini to ease direct running of example scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from unittest import IsolatedAsyncioTestCase # type: ignore | ||
|
||
|
||
class AsyncArguments(IsolatedAsyncioTestCase): | ||
async def test_something_async(self): | ||
async def addition(x, y): | ||
return x + y | ||
|
||
self.assertEqual(await addition(2, 2), 4) | ||
|
||
async def test_something_async_fails(self): | ||
async def addition(x, y): | ||
return x + y | ||
|
||
self.assertEqual(await addition(2, 2), 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters