mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
5da41fcc11
Use stacklevel=2 for warnings, as this will correctly show the callsite instead of the line where the warning is reported. Currently: ``` kasa/__init__.py:110 /home/tpr/code/python-kasa/kasa/__init__.py:110: DeprecationWarning: SmartDevice is deprecated, use IotDevice from package kasa.iot instead or use Discover.discover_single() and Device.connect() to support new protocols warn( ``` After: ``` kasa/tests/smart/modules/test_contact.py:3 /home/tpr/code/python-kasa/kasa/tests/smart/modules/test_contact.py:3: DeprecationWarning: SmartDevice is deprecated, use IotDevice from package kasa.iot instead or use Discover.discover_single() and Device.connect() to support new protocols from kasa import Module, SmartDevice ``` Currently: ``` kasa/tests/test_lightstrip.py: 56 warnings /home/tpr/code/python-kasa/kasa/device.py:559: DeprecationWarning: effect is deprecated, use: Module.LightEffect in device.modules instead warn(msg, DeprecationWarning, stacklevel=1) ``` After: ``` kasa/tests/test_lightstrip.py::test_effects_lightstrip_set_effect_transition[500-KL430(US)_2.0_1.0.9.json] /home/tpr/code/python-kasa/kasa/tests/test_lightstrip.py:62: DeprecationWarning: set_effect is deprecated, use: Module.LightEffect in device.modules instead await dev.set_effect("Candy Cane") ``` |
||
---|---|---|
.. | ||
fixtures | ||
iot/modules | ||
smart | ||
smartcamera | ||
__init__.py | ||
conftest.py | ||
device_fixtures.py | ||
discovery_fixtures.py | ||
fakeprotocol_iot.py | ||
fakeprotocol_smart.py | ||
fakeprotocol_smartcamera.py | ||
fixtureinfo.py | ||
test_aestransport.py | ||
test_bulb.py | ||
test_childdevice.py | ||
test_cli.py | ||
test_common_modules.py | ||
test_device_factory.py | ||
test_device_type.py | ||
test_device.py | ||
test_deviceconfig.py | ||
test_dimmer.py | ||
test_discovery.py | ||
test_emeter.py | ||
test_feature.py | ||
test_httpclient.py | ||
test_iotdevice.py | ||
test_klapprotocol.py | ||
test_lightstrip.py | ||
test_plug.py | ||
test_protocol.py | ||
test_readme_examples.py | ||
test_smartdevice.py | ||
test_smartprotocol.py | ||
test_sslaestransport.py | ||
test_strip.py | ||
test_usage.py |