diff mbox series

[10/41] oeqa: Use 'is None' for None comparisons

Message ID 20261115084845.701136-10-richard.purdie@linuxfoundation.org
State New
Headers show
Series [01/41] oeqa/loader: Drop code for pre python 3.5 | expand

Commit Message

Richard Purdie Nov. 15, 2026, 8:48 a.m. UTC
Comparing to None with == or != is unidiomatic and can be overridden by
__eq__; use identity checks instead.

AI-Generated: Uses Claude Opus 5.5
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/lib/oeqa/core/loader.py               | 2 +-
 meta/lib/oeqa/core/target/ssh.py           | 4 ++--
 meta/lib/oeqa/oetest.py                    | 2 +-
 meta/lib/oeqa/selftest/cases/oelib/path.py | 2 +-
 meta/lib/oeqa/utils/subprocesstweak.py     | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oeqa/core/loader.py b/meta/lib/oeqa/core/loader.py
index 1c964dadae6..5e96988b7a9 100644
--- a/meta/lib/oeqa/core/loader.py
+++ b/meta/lib/oeqa/core/loader.py
@@ -40,7 +40,7 @@  def _find_duplicated_modules(suite, directory):
 def _built_modules_dict(modules, logger):
     modules_dict = {}
 
-    if modules == None:
+    if modules is None:
         return modules_dict
 
     for module in modules:
diff --git a/meta/lib/oeqa/core/target/ssh.py b/meta/lib/oeqa/core/target/ssh.py
index 757ab67580c..e380fd84854 100644
--- a/meta/lib/oeqa/core/target/ssh.py
+++ b/meta/lib/oeqa/core/target/ssh.py
@@ -293,7 +293,7 @@  def SSHCall(command, logger, timeout=None, raw=False, **opts):
                 logger.debug('No output from SSH call')
 
         # timout or not, make sure process exits and is not hanging
-        if process.returncode == None:
+        if process.returncode is None:
             try:
                 process.wait(timeout=5)
             except TimeoutExpired:
@@ -339,7 +339,7 @@  def SSHCall(command, logger, timeout=None, raw=False, **opts):
         # whilst running and ensure we don't leave a process behind.
         if process.poll() is None:
             process.kill()
-        if process.returncode == None:
+        if process.returncode is None:
             process.wait()
         logger.debug('Something went wrong, killing SSH process')
         raise
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index a57cea74b46..f5703ea9cd3 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -583,7 +583,7 @@  class ExportTestContext(RuntimeTestContext):
         super().__init__(d, target, exported)
 
         tag = parsedArgs.get("tag", None)
-        self.tagexp = tag if tag != None else d.getVar("TEST_SUITES_TAGS")
+        self.tagexp = tag if tag is not None else d.getVar("TEST_SUITES_TAGS")
 
         self.sigterm = None
 
diff --git a/meta/lib/oeqa/selftest/cases/oelib/path.py b/meta/lib/oeqa/selftest/cases/oelib/path.py
index b963e447e37..f573dcbd580 100644
--- a/meta/lib/oeqa/selftest/cases/oelib/path.py
+++ b/meta/lib/oeqa/selftest/cases/oelib/path.py
@@ -67,7 +67,7 @@  class TestRealPath(TestCase):
 
     def test_norm(self):
         for l in self.LINKS:
-            if l[2] == None:
+            if l[2] is None:
                 continue
 
             target_p = self.__realpath(l[0], True)
diff --git a/meta/lib/oeqa/utils/subprocesstweak.py b/meta/lib/oeqa/utils/subprocesstweak.py
index 046667faa98..0da836c48de 100644
--- a/meta/lib/oeqa/utils/subprocesstweak.py
+++ b/meta/lib/oeqa/utils/subprocesstweak.py
@@ -13,7 +13,7 @@  class OETestCalledProcessError(subprocess.CalledProcessError):
         s = super().__str__()
         s = s + "\nStandard Output: " + strify(self.output)
         # stderr is not available for check_output method
-        if self.stderr != None:
+        if self.stderr is not None:
             s = s + "\nStandard Error: " + strify(self.stderr)
         return s