Skip to content

Commit

Permalink
Tests for Pinger
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed May 22, 2020
1 parent 0701fd0 commit 298a5e7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ def test_Pinger():
pinger.join()


class LimitedPinger(multiping.Pinger):
limit = 30

def set(self, idx, result):
super(LimitedPinger, self).set(idx, result)
if idx >= self.limit:
self.running = False


def test_Pinger_queue(monkeypatch):
# This will actually launch 30 ping processes
monkeypatch.setattr(multiping, 'sleep', lambda seconds: None)
pinger = LimitedPinger('localhost', 1)
pinger.run()


@pytest.mark.parametrize('argv', [
'multiping'.split(),
'multiping -h'.split(),
Expand Down

0 comments on commit 298a5e7

Please sign in to comment.