wearpants / twiggy

Pythonic logger, shipped in Redhat & Debian
BSD 3-Clause "New" or "Revised" License
47 stars 11 forks source link

Fix threading related deprecations in Python 3.10. #97

Open tirkarthi opened 3 years ago

tirkarthi commented 3 years ago

Fixes #95

tirkarthi commented 3 years ago

Warnings before PR :

 python -Wall -m pytest tests/test_lib.py                                                    
========================================================================= test session starts ==========================================================================
platform linux -- Python 3.10.0b1, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /root/checked_repos/twiggy
collected 2 items                                                                                                                                                      

tests/test_lib.py ..                                                                                                                                             [100%]

=========================================================================== warnings summary ===========================================================================
tests/test_lib.py::ThreadNameTest::test_thread_name
  /root/checked_repos/twiggy/twiggy/lib/__init__.py:7: DeprecationWarning: currentThread() is deprecated, use current_thread() instead
    return threading.currentThread().getName()

tests/test_lib.py::ThreadNameTest::test_thread_name
  /root/checked_repos/twiggy/twiggy/lib/__init__.py:7: DeprecationWarning: getName() is deprecated, get the name attribute instead
    return threading.currentThread().getName()

-- Docs: https://docs.pytest.org/en/stable/warnings.html
==================================================================== 2 passed, 2 warnings in 0.04s =====================================================================