sbidy / pywizlight

A python connector for WiZ devices
MIT License
463 stars 79 forks source link

Question: How to run tests? #75

Open scriptsrc opened 3 years ago

scriptsrc commented 3 years ago

Hey all,

pip install pytest pytest-asyncio
$ pip freeze | grep pytest
pytest==6.2.3
pytest-asyncio==0.15.1
$ pytest pywizlight/tests

platform darwin -- Python 3.9.2, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
rootdir: /Users/patrickk/github/pywizlight
plugins: asyncio-0.15.1
collected 18 items                                                                                                                                                                                                                                                                                                                     

pywizlight/tests/test_bulb.py F................. 

All seem to pass except for test_Bulb_Discovery

FAILED pywizlight/tests/test_bulb.py::TestBulb::test_Bulb_Discovery - OSError: [Errno 48] Address already in use

I don't see any documentation on setting up the tests nor are there any github actions configured to run the tests. Any idea what I'm doing wrong?

sbidy commented 3 years ago

Do you test the lib on a HASS? It seems to be that the UDP port is already in use on your system. The discovery test is a "real" test against a "fake" bulb. But this will be done via UDP (localhost). All other test are unit-test. The discovery is more an integration test.

bdraco commented 2 years ago

All seem to pass except for test_Bulb_Discovery

This test has been adjusted to use a random port so it should pass now

bdraco commented 2 years ago

This should be closable since pytest will work out of box now