Commit 5275d25c authored by Kirill Smelkov's avatar Kirill Smelkov

*: Compare strings by == or != instead of by `is` or `is not`

In python `is` checks object identity, not content:

    In [1]: a = 'hello'

    In [2]: a += ' world'

    In [3]: b = 'hello world'

    In [4]: id(a)
    Out[4]: 139735676540976

    In [5]: id(b)
    Out[5]: 139735675829040

    In [6]: a is b              <-- NOTE
    Out[6]: False

    In [7]: a == b              <-- NOTE
    Out[7]: True

So comparing strings by is is generally incorrect.

-> Fix strings comparision to use == / != everywhere (at least in found
places where string is compared wrt string literal)

We already had similar fix in a8526f4e, but seems the story continues
again.

/cc @alain.takoudjou, @Just1, @lu.xu, @jhuge, @tomo
parent b578b8cd
...@@ -265,7 +265,7 @@ class RunPromise(GenericPromise): ...@@ -265,7 +265,7 @@ class RunPromise(GenericPromise):
check_date = self.getConfig('test-check-date') check_date = self.getConfig('test-check-date')
path = os.path.join(self.getPartitionFolder(), "") + "extrafolder" path = os.path.join(self.getPartitionFolder(), "") + "extrafolder"
partitions = psutil.disk_partitions() partitions = psutil.disk_partitions()
while path is not '/': while path != '/':
if not disk_partition: if not disk_partition:
path = os.path.dirname(path) path = os.path.dirname(path)
else: else:
......
...@@ -190,7 +190,7 @@ class RunPromise(GenericPromise): ...@@ -190,7 +190,7 @@ class RunPromise(GenericPromise):
check_date = self.getConfig('test-check-date') check_date = self.getConfig('test-check-date')
path = os.path.join(self.getPartitionFolder(), "") + "extrafolder" path = os.path.join(self.getPartitionFolder(), "") + "extrafolder"
partitions = psutil.disk_partitions() partitions = psutil.disk_partitions()
while path is not '/': while path != '/':
if not disk_partition: if not disk_partition:
path = os.path.dirname(path) path = os.path.dirname(path)
else: else:
......
...@@ -43,7 +43,7 @@ class TestMonitorPartitionSpace(TestPromisePluginMixin): ...@@ -43,7 +43,7 @@ class TestMonitorPartitionSpace(TestPromisePluginMixin):
disk_partition = "" disk_partition = ""
path = os.path.join(self.partition_dir, "") + "extrafolder" path = os.path.join(self.partition_dir, "") + "extrafolder"
partitions = psutil.disk_partitions() partitions = psutil.disk_partitions()
while path is not '/': while path != '/':
if not disk_partition: if not disk_partition:
path = os.path.dirname(path) path = os.path.dirname(path)
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment