python-kasa/kasa/tests
Teemu R. 5da41fcc11
Use stacklevel=2 for warnings to report on callsites (#1219)
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")
```
2024-10-31 14:12:17 +01:00
..
fixtures Add S200B(US) fw 1.12.0 fixture (#1181) 2024-10-29 09:49:49 +00:00
iot/modules Expose ambient light setting for iot dimmers (#1210) 2024-10-31 12:17:18 +01:00
smart Add waterleak alert timestamp (#1162) 2024-10-18 13:18:12 +02:00
smartcamera Add stream_rtsp_url to camera module (#1197) 2024-10-25 18:30:21 +01:00
__init__.py mass rename to (python-)kasa (#1) 2019-12-18 09:11:18 +01:00
conftest.py Remove async magic patch from tests (#1146) 2024-10-02 17:12:10 +02:00
device_fixtures.py Add S200D button fixtures (#1161) 2024-10-29 09:37:34 +00:00
discovery_fixtures.py Add https parameter to device class factory (#1184) 2024-10-22 18:09:35 +01:00
fakeprotocol_iot.py Create common Time module and add time set cli command (#1157) 2024-10-15 08:59:25 +01:00
fakeprotocol_smart.py Use stacklevel=2 for warnings to report on callsites (#1219) 2024-10-31 14:12:17 +01:00
fakeprotocol_smartcamera.py Update SMART test framework to use fake child protocols (#1199) 2024-10-27 12:08:02 +00:00
fixtureinfo.py Update SMART test framework to use fake child protocols (#1199) 2024-10-27 12:08:02 +00:00
test_aestransport.py Enable newer encrypted discovery protocol (#1168) 2024-10-16 15:28:27 +01:00
test_bulb.py Enable ruff lint pycodestyle warnings (#1132) 2024-09-27 17:36:41 +02:00
test_childdevice.py Improve supported module checks for hub children (#1188) 2024-10-23 17:17:27 +02:00
test_cli.py Allow enabling experimental devices from environment variable (#1194) 2024-10-29 09:30:30 +00:00
test_common_modules.py Create common Time module and add time set cli command (#1157) 2024-10-15 08:59:25 +01:00
test_device_factory.py Add https parameter to device class factory (#1184) 2024-10-22 18:09:35 +01:00
test_device_type.py Refactor devices into subpackages and deprecate old names (#716) 2024-02-04 16:20:08 +01:00
test_device.py Create common Time module and add time set cli command (#1157) 2024-10-15 08:59:25 +01:00
test_deviceconfig.py Rename and deprecate exception classes (#739) 2024-02-21 16:52:55 +01:00
test_dimmer.py Add flake8-pytest-style (PT) for ruff (#1105) 2024-08-30 17:30:07 +02:00
test_discovery.py Only send 20002 discovery request with key included (#1207) 2024-10-29 16:21:24 +00:00
test_emeter.py Update SMART test framework to use fake child protocols (#1199) 2024-10-27 12:08:02 +00:00
test_feature.py Remove async magic patch from tests (#1146) 2024-10-02 17:12:10 +02:00
test_httpclient.py Add flake8-pytest-style (PT) for ruff (#1105) 2024-08-30 17:30:07 +02:00
test_iotdevice.py Create common Time module and add time set cli command (#1157) 2024-10-15 08:59:25 +01:00
test_klapprotocol.py Add autouse fixture to patch asyncio.sleep (#1131) 2024-09-27 10:57:23 +01:00
test_lightstrip.py Add flake8-pytest-style (PT) for ruff (#1105) 2024-08-30 17:30:07 +02:00
test_plug.py Refactor split smartdevice tests to test_{iot,smart}device (#822) 2024-03-15 15:55:48 +00:00
test_protocol.py Remove async magic patch from tests (#1146) 2024-10-02 17:12:10 +02:00
test_readme_examples.py Add flake8-pytest-style (PT) for ruff (#1105) 2024-08-30 17:30:07 +02:00
test_smartdevice.py Allow erroring modules to recover (#1080) 2024-07-30 19:23:07 +01:00
test_smartprotocol.py Add flake8-pytest-style (PT) for ruff (#1105) 2024-08-30 17:30:07 +02:00
test_sslaestransport.py Fix SslAesTransport default login and add tests (#1202) 2024-10-28 16:36:34 +00:00
test_strip.py Fix post update hook for iot child devices (#1011) 2024-06-25 17:58:07 +00:00
test_usage.py Add flake8-pytest-style (PT) for ruff (#1105) 2024-08-30 17:30:07 +02:00