-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e425d1
commit d164ef7
Showing
2 changed files
with
55 additions
and
0 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,28 @@ | ||
import asyncio | ||
import time | ||
import unittest | ||
|
||
import pytest | ||
|
||
from ahk import AsyncAHK | ||
|
||
async_sleep = asyncio.sleep # unasync: remove | ||
|
||
sleep = time.sleep | ||
|
||
|
||
class TestGui(unittest.IsolatedAsyncioTestCase): | ||
async def asyncSetUp(self) -> None: | ||
self.ahk = AsyncAHK() | ||
|
||
async def asyncTearDown(self) -> None: | ||
self.ahk._transport._proc.kill() | ||
time.sleep(0.2) | ||
|
||
async def test_msg_box(self): | ||
box = await self.ahk.msg_box(text='hello', title='test', timeout=3, blocking=False) | ||
await async_sleep(1) | ||
win = await self.ahk.win_get(title='test') | ||
assert win is not None | ||
with pytest.raises(TimeoutError): | ||
r = await box.result() |
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,27 @@ | ||
import asyncio | ||
import time | ||
import unittest | ||
|
||
import pytest | ||
|
||
from ahk import AHK | ||
|
||
|
||
sleep = time.sleep | ||
|
||
|
||
class TestGui(unittest.TestCase): | ||
def setUp(self) -> None: | ||
self.ahk = AHK() | ||
|
||
def tearDown(self) -> None: | ||
self.ahk._transport._proc.kill() | ||
time.sleep(0.2) | ||
|
||
def test_msg_box(self): | ||
box = self.ahk.msg_box(text='hello', title='test', timeout=3, blocking=False) | ||
sleep(1) | ||
win = self.ahk.win_get(title='test') | ||
assert win is not None | ||
with pytest.raises(TimeoutError): | ||
r = box.result() |