Commit 641a193d authored by Brian May's avatar Brian May

Use readline instead of next.

parent 71d17e44
......@@ -41,22 +41,22 @@ def test_rewrite_etc_hosts():
}
sshuttle.firewall.rewrite_etc_hosts(10)
with open("tmp/hosts") as f:
line = f.next()
line = f.readline()
s = line.split()
assert s == ['1.2.3.3', 'existing']
line = f.next()
line = f.readline()
s = line.split()
assert s == ['1.2.3.4', 'myhost',
'#', 'sshuttle-firewall-10', 'AUTOCREATED']
line = f.next()
line = f.readline()
s = line.split()
assert s == ['1.2.3.5', 'myotherhost',
'#', 'sshuttle-firewall-10', 'AUTOCREATED']
with pytest.raises(StopIteration):
line = f.next()
line = f.readline()
assert line == ""
sshuttle.firewall.restore_etc_hosts(10)
assert filecmp.cmp("tmp/hosts.orig", "tmp/hosts", shallow=False) is True
......
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