py3-nextion / pynextion

An unofficial Python library for Nextion smart display management
Apache License 2.0
8 stars 6 forks source link

Most tests fail #17

Open tbrodbeck opened 2 years ago

tbrodbeck commented 2 years ago

For example:

t@v2:~/pynextion $ pytest -s examples/text.py
====================================================================================================================== test session starts =======================================================================================================================
platform linux -- Python 3.9.2, pytest-7.0.1, pluggy-1.0.0
rootdir: /home/t/pynextion
plugins: anyio-3.5.0
collected 1 item

examples/text.py Init
cmd --> bkcmd=3
cmd --> bytearray(b'bkcmd=3\xff\xff\xff')
msg <-- b''
msg <-- <pynextion.events.EmptyMessage object at 0xb59e4fa0>
cmd --> page 0
cmd --> bytearray(b'page 0\xff\xff\xff')
msg <-- b''
msg <-- <pynextion.events.EmptyMessage object at 0xb59e4f88>
Create objects
Reset
cmd --> rest
cmd --> bytearray(b'rest\xff\xff\xff')
F

============================================================================================================================ FAILURES ============================================================================================================================
_____________________________________________________________________________________________________________________ test_text[/dev/ttyS0] ______________________________________________________________________________________________________________________

port = '/dev/ttyS0'

    @pytest.mark.parametrize("port", [PORT_DEFAULT])
    def test_text(port):
        nexSerial = PySerialNex(port)

        print("Init")
        nexSerial.init()

        print("Create objects")
        nexPage = NexPage(nexSerial, "pg_text", pid=2)

        # nexText = NexText(nexSerial, "t1", pid=2, cid=1)
        # nexText = NexText(nexSerial, "t1")
        nexText = NexText(nexSerial, "t1", cid=1)

        print("Reset")
>       nexSerial.reset()

examples/text.py:26:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pynextion.hardware.PySerialNex object at 0xb59e4c28>

    def reset(self):
        cmd = "rest"
        # ret = self.send(cmd)
        self.write(cmd)
        time.sleep(1)
        msg = self.read_all()
>       assert msg == b'\x00\x00\x00\xff\xff\xff\x88\xff\xff\xff', "rest returned %s" % msg
E       AssertionError: rest returned b''

pynextion/hardware.py:63: AssertionError
==================================================================================================================== short test summary info =====================================================================================================================
FAILED examples/text.py::test_text[/dev/ttyS0] - AssertionError: rest returned b''
======================================================================================================================= 1 failed in 1.59s ========================================================================================================================

System:

OS: Raspbian GNU/Linux 11 (bullseye) armv7l Host: Raspberry Pi 4 Model B Rev 1.2 Kernel: 5.10.92-v7l+ Uptime: 5 hours, 48 mins Packages: 593 (dpkg) Shell: bash 5.1.4 Terminal: /dev/pts/2 CPU: BCM2711 (4) @ 1.500GHz Memory: 221MiB / 3838MiB