fixing getline

This commit is contained in:
Peter Buchegger 2021-09-22 21:06:32 +01:00
parent fa87ee505e
commit e8f6f63b67
2 changed files with 21 additions and 5 deletions

View file

@ -44,10 +44,13 @@ class AprsIs:
self.socket.sendall(bytearray(f"{line}\r\n", encoding='utf8'))
def get_line(self):
line = self._get_line()
if line.startswith("#"):
return None
yield line
line_list = list(self._get_line())
new_list = []
if line_list:
for line in line_list:
if not line.startswith("#"):
new_list.append(line)
return new_list
def _get_line(self):
if self.socket:

View file

@ -1,5 +1,5 @@
from testlib.esp_dut import ESP
from testlib.aprs_con import APRSIS
from testlib.aprs_con import APRSIS, AprsIs
def test_basic_port(ESP):
@ -27,3 +27,16 @@ def test_erase(ESP):
def test_aprs_login(APRSIS):
pass
def test_aprs_msg(APRSIS):
aprs = AprsIs("OE5BPA-2", passwd="22948",
host="localhost", port=10152)
aprs.connect()
aprs.send_line("OE5BPA-2>APLG01:=4819.82NL01418.68E&Testing")
for i in range(2):
line = APRSIS.get_line()
for l in line:
if l == "OE5BPA-2>APLG01,TCPIP*,qAC,OE5BPA:=4819.82NL01418.68E&Testing":
return
raise