Changeset 1808:f1fa4cf11231


Ignore:
Timestamp:
Jun 17, 2019, 10:16:09 PM (2 months ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Use `ScriptedSession` in `TestFailingPickling`
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/test_host.py

    r1807 r1808  
    11261126    def test_failing_pickling(self):
    11271127        """Test if pickling (intentionally) isn't supported."""
    1128         with test_base.ftp_host_factory() as host:
     1128        host_script = [
     1129          Call(method_name="__init__"),
     1130          Call(method_name="pwd", result="/"),
     1131          Call(method_name="close"),
     1132        ]
     1133        file_script = [
     1134          Call(method_name="__init__"),
     1135          Call(method_name="pwd", result="/"),
     1136          Call(method_name="cwd", result=None, args=("/",)),
     1137          Call(method_name="voidcmd", result=None, args=("TYPE I",)),
     1138          Call(method_name="transfercmd", result=io.BytesIO(), args=("RETR test", None)),
     1139          Call(method_name="voidresp", result=None, args=()),
     1140          Call(method_name="close"),
     1141        ]
     1142        multisession_factory = scripted_session.factory(host_script, file_script)
     1143        with test_base.ftp_host_factory(multisession_factory) as host:
    11291144            with pytest.raises(TypeError):
    11301145                pickle.dumps(host)
    1131             with host.open("/home/sschwarzer/index.html") as file_obj:
     1146            with host.open("/test") as file_obj:
    11321147                with pytest.raises(TypeError):
    11331148                    pickle.dumps(file_obj)
Note: See TracChangeset for help on using the changeset viewer.