From 8d58f12248c0bd9e8f88296f29935fd3dc33b415 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Wed, 7 Jun 2017 14:39:18 -0600 Subject: 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 --- tests/unittests/test_handler/test_handler_ntp.py | 3 ++- 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 -- cgit v1.2.3