Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2252d60

Browse files
Using pytest [assertNotEqual]
1 parent 89784a8 commit 2252d60

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

tests/test_simple.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def test_reload(self):
234234
# check new value
235235
cmm_new = node.execute('show client_min_messages')
236236
assert ('debug1' == cmm_new[0][0].lower())
237-
self.assertNotEqual(cmm_old, cmm_new)
237+
assert (cmm_old != cmm_new)
238238

239239
def test_pg_ctl(self):
240240
with get_new_node() as node:
@@ -260,7 +260,7 @@ def test_status(self):
260260

261261
node.start()
262262

263-
self.assertNotEqual(node.pid, 0)
263+
assert (node.pid != 0)
264264
assert (node.status() == NodeStatus.Running)
265265

266266
node.stop()
@@ -400,12 +400,12 @@ def test_backup_multiple(self):
400400

401401
with node.backup(xlog_method='fetch') as backup1, \
402402
node.backup(xlog_method='fetch') as backup2:
403-
self.assertNotEqual(backup1.base_dir, backup2.base_dir)
403+
assert (backup1.base_dir != backup2.base_dir)
404404

405405
with node.backup(xlog_method='fetch') as backup:
406406
with backup.spawn_primary('node1', destroy=False) as node1, \
407407
backup.spawn_primary('node2', destroy=False) as node2:
408-
self.assertNotEqual(node1.base_dir, node2.base_dir)
408+
assert (node1.base_dir != node2.base_dir)
409409

410410
def test_backup_exhaust(self):
411411
with get_new_node() as node:
@@ -818,12 +818,12 @@ def test_pg_config(self):
818818
c2 = get_pg_config()
819819

820820
# check different instances after config change
821-
self.assertNotEqual(id(c1), id(c2))
821+
assert (id(c1) != id(c2))
822822

823823
# check different instances
824824
a = get_pg_config()
825825
b = get_pg_config()
826-
self.assertNotEqual(id(a), id(b))
826+
assert (id(a) != id(b))
827827

828828
def test_config_stack(self):
829829
# no such option
@@ -876,7 +876,7 @@ def test_auto_name(self):
876876
assert (r.status())
877877

878878
# check their names
879-
self.assertNotEqual(m.name, r.name)
879+
assert (m.name != r.name)
880880
assert ('testgres' in m.name)
881881
assert ('testgres' in r.name)
882882

@@ -1206,7 +1206,7 @@ def test_port_rereserve_during_node_start(self):
12061206

12071207
node2.init().start()
12081208

1209-
self.assertNotEqual(node2.port, node1.port)
1209+
assert (node2.port != node1.port)
12101210
assert (node2._should_free_port)
12111211
assert (__class__.tagPortManagerProxy.sm_DummyPortCurrentUsage == 0)
12121212
assert (__class__.tagPortManagerProxy.sm_DummyPortTotalUsage == C_COUNT_OF_BAD_PORT_USAGE)

tests/test_simple_remote.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def test_reload(self):
291291
# check new value
292292
cmm_new = node.execute('show client_min_messages')
293293
assert ('debug1' == cmm_new[0][0].lower())
294-
self.assertNotEqual(cmm_old, cmm_new)
294+
assert (cmm_old != cmm_new)
295295

296296
def test_pg_ctl(self):
297297
with get_remote_node(conn_params=conn_params) as node:
@@ -317,7 +317,7 @@ def test_status(self):
317317

318318
node.start()
319319

320-
self.assertNotEqual(node.pid, 0)
320+
assert (node.pid != 0)
321321
assert (node.status() == NodeStatus.Running)
322322

323323
node.stop()
@@ -453,12 +453,12 @@ def test_backup_multiple(self):
453453

454454
with node.backup(xlog_method='fetch') as backup1, \
455455
node.backup(xlog_method='fetch') as backup2:
456-
self.assertNotEqual(backup1.base_dir, backup2.base_dir)
456+
assert (backup1.base_dir != backup2.base_dir)
457457

458458
with node.backup(xlog_method='fetch') as backup:
459459
with backup.spawn_primary('node1', destroy=False) as node1, \
460460
backup.spawn_primary('node2', destroy=False) as node2:
461-
self.assertNotEqual(node1.base_dir, node2.base_dir)
461+
assert (node1.base_dir != node2.base_dir)
462462

463463
def test_backup_exhaust(self):
464464
with get_remote_node(conn_params=conn_params) as node:
@@ -865,12 +865,12 @@ def test_pg_config(self):
865865
c2 = get_pg_config()
866866

867867
# check different instances after config change
868-
self.assertNotEqual(id(c1), id(c2))
868+
assert (id(c1) != id(c2))
869869

870870
# check different instances
871871
a = get_pg_config()
872872
b = get_pg_config()
873-
self.assertNotEqual(id(a), id(b))
873+
assert (id(a) != id(b))
874874

875875
def test_config_stack(self):
876876
# no such option
@@ -927,7 +927,7 @@ def test_auto_name(self):
927927
assert (r.status())
928928

929929
# check their names
930-
self.assertNotEqual(m.name, r.name)
930+
assert (m.name != r.name)
931931
assert ('testgres' in m.name)
932932
assert ('testgres' in r.name)
933933

0 commit comments

Comments
 (0)