From 31b2fd114c741b241a4f567d0962e82c5034d7e4 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 31 Aug 2020 15:48:54 +0100 Subject: [PATCH] hacking: Stop special casing 'plugins.xenserver' This module was removed in I1b64ea1f5906b0c4dd1d5e311095cfe41e884ff7 and no longer needs to be worried about. Change-Id: I6cb74210934f71bb77ad775ea6671b4e2792f8c0 Signed-off-by: Stephen Finucane --- nova/hacking/checks.py | 6 ------ nova/tests/unit/test_hacking.py | 25 ++++++++++++++----------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/nova/hacking/checks.py b/nova/hacking/checks.py index 79228810343f..65a63f1eb512 100644 --- a/nova/hacking/checks.py +++ b/nova/hacking/checks.py @@ -362,12 +362,6 @@ def check_explicit_underscore_import(logical_line, filename): @core.flake8ext def use_jsonutils(logical_line, filename): - # the code below that path is not meant to be executed from neutron - # tree where jsonutils module is present, so don't enforce its usage - # for this subdirectory - if "plugins/xenserver" in filename: - return - # tools are OK to use the standard json module if "/tools/" in filename: return diff --git a/nova/tests/unit/test_hacking.py b/nova/tests/unit/test_hacking.py index f56276372410..c7e52ac12c73 100644 --- a/nova/tests/unit/test_hacking.py +++ b/nova/tests/unit/test_hacking.py @@ -246,17 +246,20 @@ class HackingTestCase(test.NoDBTestCase): for method in ('dump', 'dumps', 'load', 'loads'): self.assertEqual( __get_msg(method), - list(checks.use_jsonutils("json.%s(" % method, - "./nova/virt/xenapi/driver.py"))) - self.assertEqual(0, - len(list(checks.use_jsonutils("json.%s(" % method, - "./plugins/xenserver/script.py")))) - self.assertEqual(0, - len(list(checks.use_jsonutils("jsonx.%s(" % method, - "./nova/virt/xenapi/driver.py")))) - self.assertEqual(0, - len(list(checks.use_jsonutils("json.dumb", - "./nova/virt/xenapi/driver.py")))) + list(checks.use_jsonutils( + "json.%s(" % method, "./nova/virt/libvirt/driver.py")), + ) + self.assertEqual( + 0, + len(list(checks.use_jsonutils( + "jsonx.%s(" % method, "./nova/virt/libvirt/driver.py"))), + ) + + self.assertEqual( + 0, + len(list(checks.use_jsonutils( + "json.dumb", "./nova/virt/libvirt/driver.py"))), + ) # We are patching pycodestyle so that only the check under test is actually # installed.