'jsonschema' imported but unused

Bug #1695918 reported by Joshua Powers on 2017-06-05
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Undecided
Unassigned

Bug Description

From latest build tests:
tests/unittests/test_handler/test_handler_ntp.py:20: 'jsonschema' imported but unused
tests/unittests/test_handler/test_schema.py:16: 'jsonschema' imported but unused

Steps to reproduce:
# git clone master
# cd cloud-init
# tox -e tip-pyflakes

The offending code in both files is:
try:
    import jsonschema # NOQA
    _missing_jsonschema_dep = False
except ImportError:
    _missing_jsonschema_dep = True

Joshua Powers (powersj) wrote :

The NOQA comment does not appear to work across pyflakes and flake8. A better solution is to assert the import right after to avoid needing to make exceptions for both linters & checkers.

My suggestion:

try:
    import jsonschema
    assert jsonschema
    _missing_jsonschema_dep = False

Joshua Powers (powersj) wrote :
Changed in cloud-init:
status: New → Fix Committed

This bug is believed to be fixed in cloud-init in 17.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers