Commit 63131789 authored by Jérome Perrin's avatar Jérome Perrin

proftpd/test: a bit better type annotations

parent e58606b7
...@@ -41,14 +41,20 @@ from paramiko.ssh_exception import AuthenticationException ...@@ -41,14 +41,20 @@ from paramiko.ssh_exception import AuthenticationException
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
from slapos.testing.utils import findFreeTCPPort from slapos.testing.utils import findFreeTCPPort
from typing import Dict from typing import Dict, TYPE_CHECKING
setUpModule, SlapOSInstanceTestCase = makeModuleSetUpAndTestCaseClass( setUpModule, _SlapOSInstanceTestCase = makeModuleSetUpAndTestCaseClass(
os.path.abspath( os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', 'software.cfg'))) os.path.join(os.path.dirname(__file__), '..', 'software.cfg')))
class ProFTPdTestCase(SlapOSInstanceTestCase): # type: ignore if TYPE_CHECKING:
from slapos.testing.testcase import SlapOSInstanceTestCase
else:
SlapOSInstanceTestCase = _SlapOSInstanceTestCase
class ProFTPdTestCase(SlapOSInstanceTestCase):
def _getConnection(self, username:str=None, password:str=None, hostname:str=None) -> pysftp.Connection: def _getConnection(self, username:str=None, password:str=None, hostname:str=None) -> pysftp.Connection:
"""Returns a pysftp connection connected to the SFTP """Returns a pysftp connection connected to the SFTP
...@@ -198,6 +204,7 @@ class TestBan(ProFTPdTestCase): ...@@ -198,6 +204,7 @@ class TestBan(ProFTPdTestCase):
class TestInstanceParameterPort(ProFTPdTestCase): class TestInstanceParameterPort(ProFTPdTestCase):
free_port: int
@classmethod @classmethod
def getInstanceParameterDict(cls) -> Dict[str, str]: def getInstanceParameterDict(cls) -> Dict[str, str]:
cls.free_port = findFreeTCPPort(cls._ipv4_address) cls.free_port = findFreeTCPPort(cls._ipv4_address)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment