pywizlight icon indicating copy to clipboard operation
pywizlight copied to clipboard

Question: How to run tests?

Open scriptsrc opened this issue 3 years ago • 3 comments

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?

scriptsrc avatar Apr 27 '21 17:04 scriptsrc

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.

sbidy avatar May 01 '21 10:05 sbidy

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 avatar Feb 09 '22 00:02 bdraco

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

bdraco avatar Feb 11 '22 17:02 bdraco