comparison tests/test-check-interfaces.py @ 37296:78103e4138b1

wireproto: port protocol handler to zope.interface zope.interface is superior to the abc module. Let's port to it. As part of this, we add tests for interface conformance for classes implementing the interface. Differential Revision: https://phab.mercurial-scm.org/D2983
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 23 Mar 2018 16:24:53 -0700
parents 0dfb5672f015
children 39f7d4ee8bcd
comparison
equal deleted inserted replaced
37295:45b39c69fae0 37296:78103e4138b1
17 repository, 17 repository,
18 sshpeer, 18 sshpeer,
19 statichttprepo, 19 statichttprepo,
20 ui as uimod, 20 ui as uimod,
21 unionrepo, 21 unionrepo,
22 wireprotoserver,
23 wireprototypes,
22 ) 24 )
23 25
24 rootdir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) 26 rootdir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
25 27
26 def checkobject(o): 28 def checkobject(o):
120 ziverify.verifyClass(repository.completelocalrepository, 122 ziverify.verifyClass(repository.completelocalrepository,
121 localrepo.localrepository) 123 localrepo.localrepository)
122 repo = localrepo.localrepository(ui, rootdir) 124 repo = localrepo.localrepository(ui, rootdir)
123 checkzobject(repo) 125 checkzobject(repo)
124 126
127 ziverify.verifyClass(wireprototypes.baseprotocolhandler,
128 wireprotoserver.sshv1protocolhandler)
129 ziverify.verifyClass(wireprototypes.baseprotocolhandler,
130 wireprotoserver.sshv2protocolhandler)
131 ziverify.verifyClass(wireprototypes.baseprotocolhandler,
132 wireprotoserver.httpv1protocolhandler)
133 ziverify.verifyClass(wireprototypes.baseprotocolhandler,
134 wireprotoserver.httpv2protocolhandler)
135
136 sshv1 = wireprotoserver.sshv1protocolhandler(None, None, None)
137 checkzobject(sshv1)
138 sshv2 = wireprotoserver.sshv2protocolhandler(None, None, None)
139 checkzobject(sshv2)
140
141 httpv1 = wireprotoserver.httpv1protocolhandler(None, None, None)
142 checkzobject(httpv1)
143 httpv2 = wireprotoserver.httpv2protocolhandler(None, None)
144 checkzobject(httpv2)
145
125 main() 146 main()