Merge ~powersj/cloud-init:style-fix into cloud-init:master

Proposed by Joshua Powers
Status: Merged
Approved by: Scott Moser
Approved revision: cac1e9b3a7eb30947e5ad11966954857f44463cf
Merged at revision: 8d58f12248c0bd9e8f88296f29935fd3dc33b415
Proposed branch: ~powersj/cloud-init:style-fix
Merge into: cloud-init:master
Diff against target: 28 lines (+4/-2)
2 files modified
tests/unittests/test_handler/test_handler_ntp.py (+2/-1)
tests/unittests/test_handler/test_schema.py (+2/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
cloud-init Commiters Pending
Review via email: mp+325274@code.launchpad.net

Commit message

test: Fix lint check of unused import

The jsonschema package is used only when available, but the lint
check thinks the import is unused across pyflakes and flake8. In
order to avoid having exceptions for both assert that the import
works right after and the import is considered used.

LP: #1695918

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :

The code looks fine, but I'm slightly confused by the commit message.

Can you explain why we're using assert modulename? Possible mention in the code as a comment as well.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)

There was an error fetching revisions from git servers. Please try again in a few minutes. If the problem persists, contact Launchpad support.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tests/unittests/test_handler/test_handler_ntp.py b/tests/unittests/test_handler/test_handler_ntp.py
2index 25d7365..3a9f7f7 100644
3--- a/tests/unittests/test_handler/test_handler_ntp.py
4+++ b/tests/unittests/test_handler/test_handler_ntp.py
5@@ -17,7 +17,8 @@ pools {{pools}}
6 """
7
8 try:
9- import jsonschema # NOQA
10+ import jsonschema
11+ assert jsonschema # avoid pyflakes error F401: import unused
12 _missing_jsonschema_dep = False
13 except ImportError:
14 _missing_jsonschema_dep = True
15diff --git a/tests/unittests/test_handler/test_schema.py b/tests/unittests/test_handler/test_schema.py
16index fd0e4f5..eda4802 100644
17--- a/tests/unittests/test_handler/test_schema.py
18+++ b/tests/unittests/test_handler/test_schema.py
19@@ -13,7 +13,8 @@ from six import StringIO
20 from textwrap import dedent
21
22 try:
23- import jsonschema # NOQA
24+ import jsonschema
25+ assert jsonschema # avoid pyflakes error F401: import unused
26 _missing_jsonschema_dep = False
27 except ImportError:
28 _missing_jsonschema_dep = True

Subscribers

People subscribed via source and target branches