Don't use nested.

Is Python 2.x only. Not supported under Python 3.x.
This commit is contained in:
Brian May 2015-11-17 09:32:40 +11:00
parent cf0aaa7134
commit 9d443e4155

View File

@ -1,5 +1,4 @@
from mock import Mock, patch, call
from contextlib import nested
import io
import os
import os.path
@ -63,11 +62,9 @@ def test_rewrite_etc_hosts():
assert filecmp.cmp("tmp/hosts.orig", "tmp/hosts", shallow=False) is True
def test_main():
with nested(
patch('sshuttle.firewall.setup_daemon'),
patch('sshuttle.firewall.get_method')
) as (mock_setup_daemon, mock_get_method):
@patch('sshuttle.firewall.setup_daemon')
@patch('sshuttle.firewall.get_method')
def test_main(mock_get_method, mock_setup_daemon):
stdin, stdout = setup_daemon()
mock_setup_daemon.return_value = stdin, stdout