Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test case deprecation warnings #126

Closed
kashifpk opened this issue Nov 8, 2021 · 2 comments
Closed

Fix test case deprecation warnings #126

kashifpk opened this issue Nov 8, 2021 · 2 comments

Comments

@kashifpk
Copy link
Contributor

kashifpk commented Nov 8, 2021

When running test cases on ubuntu dev setup I get deprecation warnings which will cause errors starting from python 3.10.

PYTHONPATH=./ pytest --cov=minerconfig --cov=lib                                                                                             
============================================================= test session starts ==============================================================
platform linux -- Python 3.8.10, pytest-6.2.4, py-1.11.0, pluggy-0.13.1
rootdir: /MyWork/Nebra/code/hm-config                                   
plugins: cov-2.12.1                                                     
collected 47 items                                                                                                                              
                                                                        
tests/gatewayconfig/test_file_loader.py .....                                                                                            [ 10%] 
tests/gatewayconfig/test_gatewayconfig_app.py .                                                                                          [ 12%] 
tests/gatewayconfig/test_gatewayconfig_shared_state.py ..                                                                                [ 17%] 
tests/gatewayconfig/bluetooth/test_bluetooth_connection_advertisement.py .................                                               [ 53%] 
tests/gatewayconfig/bluetooth/test_diagnostics_characteristic.py .                                                                       [ 55%] 
tests/gatewayconfig/processors/test_diagnostics_processor.py .                                                                           [ 57%] 
tests/lib/cputemp/test_ble_tools.py ....                                                                                                 [ 65%] 
tests/lib/cputemp/test_nmcli_custom.py ................                                                                                  [100%]/
MyWork/Nebra/venv/lib/python3.8/site-packages/coverage/inorout.py:516: CoverageWarning: Module minerconfig was never imported. (module-not-impor
ted)                                
  self.warn(f"Module {pkg} was never imported.", slug="module-not-imported")                                                                   
                                    

=============================================================== warnings summary ===============================================================
../../venv/lib/python3.8/site-packages/dbus/service.py:35
  /MyWork/Nebra/venv/lib/python3.8/site-packages/dbus/service.py:35: DeprecationWarning: Using or importing the ABCs from 'collections' instead 
of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
    from collections import Sequence 

../../venv/lib/python3.8/site-packages/dbus/decorators.py:330
  /MyWork/Nebra/venv/lib/python3.8/site-packages/dbus/decorators.py:330: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0
, use inspect.signature() or inspect.getfullargspec()
    args = inspect.getargspec(func)[0]

tests/gatewayconfig/test_gatewayconfig_app.py::TestGatewayconfigSha::test_gpio_pins
  /MyWork/Nebra/code/hm-config/lib/cputemp/service.py:59: PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead
    self.mainloop = GObject.MainLoop()

-- Docs: https://docs.pytest.org/en/stable/warnings.html

---------- coverage: platform linux, python 3.8.10-final-0 -----------
Name                           Stmts   Miss  Cover
--------------------------------------------------
lib/cputemp/advertisement.py      84      1    99%
lib/cputemp/bletools.py           40      9    78%
lib/cputemp/service.py           191     62    68%
--------------------------------------------------
TOTAL                            315     72    77%

======================================================== 47 passed, 3 warnings in 1.13s ========================================================

Since python 3.10 has already been released anyone using latest python (including upcoming ubuntu 22.04 LTS) will cause these tests to fail.

@vpetersson
Copy link
Contributor

@kashifpk Yeah this is part of a bigger discussion. In short, we are going to unpin the Python packages in the Dockerfile.

@vpetersson
Copy link
Contributor

Closed in favor of #127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants