further type hinting for tests

This commit is contained in:
Blake Harnden 2020-05-29 21:41:58 -07:00
parent 048fc1aaf9
commit 10fd844397
2 changed files with 13 additions and 5 deletions

View file

@ -2,17 +2,20 @@
Unit tests for testing CORE EMANE networks.
"""
import os
from tempfile import TemporaryFile
from xml.etree import ElementTree
import pytest
from core.emane.bypass import EmaneBypassModel
from core.emane.commeffect import EmaneCommEffectModel
from core.emane.emanemodel import EmaneModel
from core.emane.ieee80211abg import EmaneIeee80211abgModel
from core.emane.nodes import EmaneNet
from core.emane.rfpipe import EmaneRfPipeModel
from core.emane.tdma import EmaneTdmaModel
from core.emulator.emudata import NodeOptions
from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.session import Session
from core.errors import CoreCommandError, CoreError
from core.nodes.base import CoreNode
@ -38,7 +41,7 @@ def ping(from_node, to_node, ip_prefixes, count=3):
class TestEmane:
@pytest.mark.parametrize("model", _EMANE_MODELS)
def test_models(self, session, model, ip_prefixes):
def test_models(self, session: Session, model: EmaneModel, ip_prefixes: IpPrefixes):
"""
Test emane models within a basic network.
@ -81,7 +84,9 @@ class TestEmane:
status = ping(node_one, node_two, ip_prefixes, count=5)
assert not status
def test_xml_emane(self, session, tmpdir, ip_prefixes):
def test_xml_emane(
self, session: Session, tmpdir: TemporaryFile, ip_prefixes: IpPrefixes
):
"""
Test xml client methods for emane.

View file

@ -4,6 +4,7 @@ Unit tests for testing basic CORE networks.
import os
import threading
from typing import Type
import pytest
@ -12,7 +13,7 @@ from core.emulator.enumerations import MessageFlags
from core.emulator.session import Session
from core.errors import CoreCommandError
from core.location.mobility import BasicRangeModel, Ns2ScriptedMobility
from core.nodes.base import CoreNode
from core.nodes.base import CoreNode, NodeBase
from core.nodes.network import HubNode, PtpNet, SwitchNode, WlanNode
_PATH = os.path.abspath(os.path.dirname(__file__))
@ -32,7 +33,9 @@ def ping(from_node, to_node, ip_prefixes):
class TestCore:
@pytest.mark.parametrize("net_type", _WIRED)
def test_wired_ping(self, session, net_type, ip_prefixes):
def test_wired_ping(
self, session: Session, net_type: Type[NodeBase], ip_prefixes: IpPrefixes
):
"""
Test ptp node network.