Skip to content

Commit aae7bc7

Browse files
authored
tests: skip tests that require HOSTNAME != 'localhost' (#501)
Inspired by arkamar/gentoo@1d69b11
1 parent e341732 commit aae7bc7

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

tests/CLIClushTest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,14 @@ def test_009_file_copy_tty(self):
215215
finally:
216216
delattr(ClusterShell.CLI.Clush, '_f_user_interaction')
217217

218+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
218219
def test_010_diff(self):
219220
"""test clush (diff)"""
220221
self._clush_t(["-w", HOSTNAME, "--diff", "echo", "ok"], None, b"")
221222
self._clush_t(["-w", "%s,localhost" % HOSTNAME, "--diff", "echo",
222223
"ok"], None, b"")
223224

225+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
224226
def test_011_diff_tty(self):
225227
"""test clush (diff) [tty]"""
226228
setattr(ClusterShell.CLI.Clush, '_f_user_interaction', True)
@@ -229,6 +231,7 @@ def test_011_diff_tty(self):
229231
finally:
230232
delattr(ClusterShell.CLI.Clush, '_f_user_interaction')
231233

234+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
232235
def test_012_diff_null(self):
233236
"""test clush (diff w/o output)"""
234237
rxs = r"^--- %s\n\+\+\+ localhost\n@@ -1(,1)? \+[01],0 @@\n-ok\n$" % HOSTNAME
@@ -268,6 +271,7 @@ def test_016_stderr_tty(self):
268271
finally:
269272
delattr(ClusterShell.CLI.Clush, '_f_user_interaction')
270273

274+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
271275
def test_017_retcodes(self):
272276
"""test clush (retcodes)"""
273277
s = "clush: %s: exited with exit code 1\n" % HOSTNAME
@@ -301,6 +305,7 @@ def test_017_retcodes(self):
301305
s.encode())
302306
self._clush_t(["-w", duo, "-S", "-b", "-q", "/bin/false"], None, b"", 1)
303307

308+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
304309
def test_018_retcodes_tty(self):
305310
"""test clush (retcodes) [tty]"""
306311
setattr(ClusterShell.CLI.Clush, '_f_user_interaction', True)
@@ -468,6 +473,7 @@ def test_030_config_options(self):
468473
"color=never", "-w", HOSTNAME, "echo", "ok"], None,
469474
self.output_ok)
470475

476+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
471477
def test_031_progress(self):
472478
"""test clush -P/--progress"""
473479
self._clush_t(["-w", HOSTNAME, "--progress", "echo", "ok"], None,
@@ -518,6 +524,7 @@ def test_033_worker_pdsh_tty(self):
518524
finally:
519525
delattr(ClusterShell.CLI.Clush, '_f_user_interaction')
520526

527+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
521528
def test_034_pick(self):
522529
"""test clush --pick"""
523530
rxs = r"^(localhost|%s): foo\n$" % HOSTNAME

tests/TaskDistantMixin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import pwd
77
import shutil
8+
import unittest
89
import warnings
910

1011
from TLib import HOSTNAME, make_temp_filename, make_temp_dir
@@ -722,6 +723,7 @@ def ev_hup(self, worker, node, rc):
722723
def ev_close(self, worker, timedout):
723724
self.close_count += 1
724725

726+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
725727
def testWorkerEventCount(self):
726728
test_eh = self.__class__.TEventHandlerEvCountChecker()
727729
nodes = "localhost,%s" % HOSTNAME

tests/TaskDistantPdshMixin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from ClusterShell.Worker.EngineClient import *
1414

1515
import socket
16+
import unittest
1617

1718
# TEventHandlerChecker 'received event' flags
1819
EV_START = 0x01
@@ -507,6 +508,7 @@ def ev_hup(self, worker, node, rc):
507508
def ev_close(self, worker, timedout):
508509
self.close_count += 1
509510

511+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
510512
def testWorkerEventCount(self):
511513
test_eh = self.__class__.TEventHandlerEvCountChecker()
512514
nodes = "localhost,%s" % HOSTNAME

tests/TreeWorkerTest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def ev_close(self, worker, timedout):
100100
self.ev_timedout_cnt += 1
101101

102102

103+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
103104
class TreeWorkerTest(unittest.TestCase):
104105
"""
105106
TreeWorkerTest: test TreeWorker

tests/WorkerExecTest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def test_one_node_error(self):
4545
self.assertEqual(task_self().max_retcode(), 1)
4646
self.assertEqual(task_self().node_buffer('localhost'), b'')
4747

48+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
4849
def test_timeout(self):
4950
"""test ExecWorker with a timeout"""
5051
nodes = "localhost,%s" % HOSTNAME
@@ -67,6 +68,7 @@ def test_bad_placeholder(self):
6768
self.assertRaises(WorkerError, self.execw,
6869
nodes="localhost", handler=None, command="echo %")
6970

71+
@unittest.skipIf(HOSTNAME == 'localhost', "does not work with hostname set to 'localhost'")
7072
def test_rank_placeholder(self):
7173
"""test ExecWorker with several nodes and %n (rank)"""
7274
nodes = "localhost,%s" % HOSTNAME

0 commit comments

Comments
 (0)