-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Saikrishna Arcot <[email protected]>
- Loading branch information
1 parent
d78b791
commit 2dbbb5c
Showing
1 changed file
with
27 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,27 @@ | ||
import asyncio | ||
import os | ||
import sys | ||
import time | ||
from unittest import TestCase | ||
|
||
modules_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
sys.path.insert(0, os.path.join(modules_path, 'src')) | ||
|
||
import ax_interface | ||
|
||
class SonicMIB(metaclass=ax_interface.mib.MIBMeta): | ||
""" | ||
Test | ||
""" | ||
|
||
class TestAgentLoop(TestCase): | ||
|
||
async def delayed_shutdown(self, agent): | ||
await asyncio.sleep(5) | ||
await agent.shutdown() | ||
|
||
def test_agent_loop(self): | ||
event_loop = asyncio.get_event_loop() | ||
agent = ax_interface.Agent(SonicMIB, 5, event_loop) | ||
event_loop.create_task(self.delayed_shutdown(agent)) | ||
event_loop.run_until_complete(agent.run_in_event_loop()) |