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