diff options
author | Joshua Powers <josh.powers@canonical.com> | 2017-06-07 14:39:18 -0600 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-06-07 17:22:13 -0400 |
commit | 8d58f12248c0bd9e8f88296f29935fd3dc33b415 (patch) | |
tree | f1edfe5d16091da23d4e4087d80f35e5e7809b39 | |
parent | 802e7cb2da8e2d0225525160e6edd6b58b275b8c (diff) | |
download | vyos-cloud-init-8d58f12248c0bd9e8f88296f29935fd3dc33b415.tar.gz vyos-cloud-init-8d58f12248c0bd9e8f88296f29935fd3dc33b415.zip |
test: Fix pyflakes complaint 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.
The '# NOQA' doesn't affect pyflakes (only flake8).
LP: #1695918
-rw-r--r-- | tests/unittests/test_handler/test_handler_ntp.py | 3 | ||||
-rw-r--r-- | tests/unittests/test_handler/test_schema.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/tests/unittests/test_handler/test_handler_ntp.py b/tests/unittests/test_handler/test_handler_ntp.py index 25d7365a..3a9f7f7e 100644 --- a/tests/unittests/test_handler/test_handler_ntp.py +++ b/tests/unittests/test_handler/test_handler_ntp.py @@ -17,7 +17,8 @@ pools {{pools}} """ try: - import jsonschema # NOQA + import jsonschema + assert jsonschema # avoid pyflakes error F401: import unused _missing_jsonschema_dep = False except ImportError: _missing_jsonschema_dep = True diff --git a/tests/unittests/test_handler/test_schema.py b/tests/unittests/test_handler/test_schema.py index fd0e4f5e..eda4802a 100644 --- a/tests/unittests/test_handler/test_schema.py +++ b/tests/unittests/test_handler/test_schema.py @@ -13,7 +13,8 @@ from six import StringIO from textwrap import dedent try: - import jsonschema # NOQA + import jsonschema + assert jsonschema # avoid pyflakes error F401: import unused _missing_jsonschema_dep = False except ImportError: _missing_jsonschema_dep = True |