Mercurial > hg-stable
annotate tests/test-check-interfaces.py @ 37630:e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Now that we've defined our new interface for issuing commands,
let's implement it.
We add the interface to the base peer interface. This means all
peer types must implement it.
The only peer types that we have are the local peer in localrepo
and a shared wire peer for version 1 of the wire protocol.
The local peer implementation is pretty straightforward. We
don't do anything fancy and just return a resolved future with
the result of a method call. This is similar to what
localiterbatcher does.
The wire protocol version 1 implementation is a bit more complicated
and is a more robust implementation.
The wire executor queues commands by default. And because the new
executor interface always allows multiple commands but not all version
1 commands are @batchable, it has to check that the requested commands
are batchable if multiple commands are being requested.
The wire executor currently only supports executing a single command.
This is for simplicity reasons. Support for multiple commands will
be added in a separate commit.
To prove the new interface works, a call to the "known" command
during discovery has been updated to use the new API.
It's worth noting that both implementations require a method having
the command name to exist on the peer. There is at least one caller
in core that don't have a method calls peer._call() directly. We
may need to shore up the requirements later...
Differential Revision: https://phab.mercurial-scm.org/D3268
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 13 Apr 2018 10:51:23 -0700 |
parents | ae8730877371 |
children | cc8c06835097 |
rev | line source |
---|---|
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
1 # Test that certain objects conform to well-defined interfaces. |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
2 |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
3 from __future__ import absolute_import, print_function |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
4 |
37183
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
5 import os |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
6 |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
7 from mercurial.thirdparty.zope import ( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
8 interface as zi, |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
9 ) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
10 from mercurial.thirdparty.zope.interface import ( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
11 verify as ziverify, |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
12 ) |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
13 from mercurial import ( |
34314
afcbc6f64d27
tests: add interface checks for bundle, statichttp, and union peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33828
diff
changeset
|
14 bundlerepo, |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
15 filelog, |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
16 httppeer, |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
17 localrepo, |
37183
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
18 repository, |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
19 sshpeer, |
34314
afcbc6f64d27
tests: add interface checks for bundle, statichttp, and union peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33828
diff
changeset
|
20 statichttprepo, |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 ui as uimod, |
34314
afcbc6f64d27
tests: add interface checks for bundle, statichttp, and union peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
33828
diff
changeset
|
22 unionrepo, |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
23 vfs as vfsmod, |
37296
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
24 wireprotoserver, |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
25 wireprototypes, |
37630
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
26 wireprotov1peer, |
37545
93397c4633f6
wireproto: extract HTTP version 2 code to own module
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37441
diff
changeset
|
27 wireprotov2server, |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 ) |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 |
37183
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
30 rootdir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
31 |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
32 def checkzobject(o, allowextra=False): |
37183
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
33 """Verify an object with a zope interface.""" |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
34 ifaces = zi.providedBy(o) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
35 if not ifaces: |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
36 print('%r does not provide any zope interfaces' % o) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
37 return |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
38 |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
39 # Run zope.interface's built-in verification routine. This verifies that |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
40 # everything that is supposed to be present is present. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
41 for iface in ifaces: |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
42 ziverify.verifyObject(iface, o) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
43 |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
44 if allowextra: |
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
45 return |
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
46 |
37183
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
47 # Now verify that the object provides no extra public attributes that |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
48 # aren't declared as part of interfaces. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
49 allowed = set() |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
50 for iface in ifaces: |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
51 allowed |= set(iface.names(all=True)) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
52 |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
53 public = {a for a in dir(o) if not a.startswith('_')} |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
54 |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
55 for attr in sorted(public - allowed): |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
56 print('public attribute not declared in interfaces: %s.%s' % ( |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
57 o.__class__.__name__, attr)) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
58 |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 # Facilitates testing localpeer. |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
60 class dummyrepo(object): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 def __init__(self): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
62 self.ui = uimod.ui() |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
63 def filtered(self, name): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
64 pass |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
65 def _restrictcapabilities(self, caps): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
66 pass |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
67 |
37009
8e89c2bec1f7
httppeer: refactor how httppeer is created (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36401
diff
changeset
|
68 class dummyopener(object): |
8e89c2bec1f7
httppeer: refactor how httppeer is created (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36401
diff
changeset
|
69 handlers = [] |
8e89c2bec1f7
httppeer: refactor how httppeer is created (API)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36401
diff
changeset
|
70 |
37552
8b8a845c85fc
httppeer: perform capabilities request in makepeer()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37547
diff
changeset
|
71 # Facilitates testing sshpeer without requiring a server. |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
72 class badpeer(httppeer.httppeer): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
73 def __init__(self): |
37552
8b8a845c85fc
httppeer: perform capabilities request in makepeer()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37547
diff
changeset
|
74 super(badpeer, self).__init__(None, None, None, dummyopener(), None, |
8b8a845c85fc
httppeer: perform capabilities request in makepeer()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37547
diff
changeset
|
75 None) |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
76 self.badattribute = True |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
77 |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
78 def badmethod(self): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
79 pass |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
80 |
36401
11ba1a96f946
sshpeer: defer pipe buffering and stderr sidechannel binding
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36017
diff
changeset
|
81 class dummypipe(object): |
11ba1a96f946
sshpeer: defer pipe buffering and stderr sidechannel binding
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36017
diff
changeset
|
82 def close(self): |
11ba1a96f946
sshpeer: defer pipe buffering and stderr sidechannel binding
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36017
diff
changeset
|
83 pass |
11ba1a96f946
sshpeer: defer pipe buffering and stderr sidechannel binding
Gregory Szorc <gregory.szorc@gmail.com>
parents:
36017
diff
changeset
|
84 |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
85 def main(): |
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
86 ui = uimod.ui() |
37183
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
87 # Needed so we can open a local repo with obsstore without a warning. |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
88 ui.setconfig('experimental', 'evolution.createmarkers', True) |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
89 |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
90 checkzobject(badpeer()) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
91 |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
92 ziverify.verifyClass(repository.ipeerbaselegacycommands, |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
93 httppeer.httppeer) |
37552
8b8a845c85fc
httppeer: perform capabilities request in makepeer()
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37547
diff
changeset
|
94 checkzobject(httppeer.httppeer(None, None, None, dummyopener(), None, None)) |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
95 |
37609
01bfe5ad0c53
httppeer: implement ipeerconnection
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37552
diff
changeset
|
96 ziverify.verifyClass(repository.ipeerconnection, |
01bfe5ad0c53
httppeer: implement ipeerconnection
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37552
diff
changeset
|
97 httppeer.httpv2peer) |
37611
ae8730877371
httppeer: basic implementation of capabilities interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37609
diff
changeset
|
98 ziverify.verifyClass(repository.ipeercapabilities, |
ae8730877371
httppeer: basic implementation of capabilities interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37609
diff
changeset
|
99 httppeer.httpv2peer) |
37609
01bfe5ad0c53
httppeer: implement ipeerconnection
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37552
diff
changeset
|
100 checkzobject(httppeer.httpv2peer(None, '', None, None, None, None)) |
01bfe5ad0c53
httppeer: implement ipeerconnection
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37552
diff
changeset
|
101 |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
102 ziverify.verifyClass(repository.ipeerbase, |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
103 localrepo.localpeer) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
104 checkzobject(localrepo.localpeer(dummyrepo())) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
105 |
37630
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
106 ziverify.verifyClass(repository.ipeercommandexecutor, |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
107 localrepo.localcommandexecutor) |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
108 checkzobject(localrepo.localcommandexecutor(None)) |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
109 |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
110 ziverify.verifyClass(repository.ipeercommandexecutor, |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
111 wireprotov1peer.peerexecutor) |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
112 checkzobject(wireprotov1peer.peerexecutor(None)) |
e1b32dc4646c
wireproto: implement command executor interface for version 1 peers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37611
diff
changeset
|
113 |
37320
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
114 ziverify.verifyClass(repository.ipeerbaselegacycommands, |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
115 sshpeer.sshv1peer) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
116 checkzobject(sshpeer.sshv1peer(ui, 'ssh://localhost/foo', None, dummypipe(), |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
117 dummypipe(), None, None)) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
118 |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
119 ziverify.verifyClass(repository.ipeerbaselegacycommands, |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
120 sshpeer.sshv2peer) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
121 checkzobject(sshpeer.sshv2peer(ui, 'ssh://localhost/foo', None, dummypipe(), |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
122 dummypipe(), None, None)) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
123 |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
124 ziverify.verifyClass(repository.ipeerbase, bundlerepo.bundlepeer) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
125 checkzobject(bundlerepo.bundlepeer(dummyrepo())) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
126 |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
127 ziverify.verifyClass(repository.ipeerbase, statichttprepo.statichttppeer) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
128 checkzobject(statichttprepo.statichttppeer(dummyrepo())) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
129 |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
130 ziverify.verifyClass(repository.ipeerbase, unionrepo.unionpeer) |
39f7d4ee8bcd
repository: port peer interfaces to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37296
diff
changeset
|
131 checkzobject(unionrepo.unionpeer(dummyrepo())) |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
132 |
37183
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
133 ziverify.verifyClass(repository.completelocalrepository, |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
134 localrepo.localrepository) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
135 repo = localrepo.localrepository(ui, rootdir) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
136 checkzobject(repo) |
0dfb5672f015
repository: define interface for local repositories
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37009
diff
changeset
|
137 |
37296
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
138 ziverify.verifyClass(wireprototypes.baseprotocolhandler, |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
139 wireprotoserver.sshv1protocolhandler) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
140 ziverify.verifyClass(wireprototypes.baseprotocolhandler, |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
141 wireprotoserver.sshv2protocolhandler) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
142 ziverify.verifyClass(wireprototypes.baseprotocolhandler, |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
143 wireprotoserver.httpv1protocolhandler) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
144 ziverify.verifyClass(wireprototypes.baseprotocolhandler, |
37545
93397c4633f6
wireproto: extract HTTP version 2 code to own module
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37441
diff
changeset
|
145 wireprotov2server.httpv2protocolhandler) |
37296
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
146 |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
147 sshv1 = wireprotoserver.sshv1protocolhandler(None, None, None) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
148 checkzobject(sshv1) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
149 sshv2 = wireprotoserver.sshv2protocolhandler(None, None, None) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
150 checkzobject(sshv2) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
151 |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
152 httpv1 = wireprotoserver.httpv1protocolhandler(None, None, None) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
153 checkzobject(httpv1) |
37545
93397c4633f6
wireproto: extract HTTP version 2 code to own module
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37441
diff
changeset
|
154 httpv2 = wireprotov2server.httpv2protocolhandler(None, None) |
37296
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
155 checkzobject(httpv2) |
78103e4138b1
wireproto: port protocol handler to zope.interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37183
diff
changeset
|
156 |
37441
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
157 ziverify.verifyClass(repository.ifilestorage, filelog.filelog) |
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
158 |
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
159 vfs = vfsmod.vfs('.') |
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
160 fl = filelog.filelog(vfs, 'dummy.i') |
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
161 checkzobject(fl, allowextra=True) |
a3202fa83aff
filelog: declare that filelog implements a storage interface
Gregory Szorc <gregory.szorc@gmail.com>
parents:
37320
diff
changeset
|
162 |
33828
b70029f355a3
tests: verify that peer instances only expose interface members
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
163 main() |