/usr/lib/python2.7/dist-packages/zope/component/standalonetests.py is in python-zope.component 4.3.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | """
See: https://bugs.launchpad.net/zope3/+bug/98401
"""
import sys
import pickle
def write(x): # pragma: NO COVER
sys.stdout.write('%s\n' % x)
if __name__ == "__main__": #pragma NO COVER (runs in subprocess)
if sys.version_info[0] >= 3:
# TextIO? Are you kidding me?
data = sys.stdin.buffer.read()
else:
data = sys.stdin.read()
sys.path = pickle.loads(data)
write('XXXXXXXXXX')
for p in sys.path:
write('- %s' % p)
write('XXXXXXXXXX')
import zope
from zope.interface import Interface
from zope.interface import implementer
class I1(Interface):
pass
class I2(Interface):
pass
@implementer(I1)
class Ob(object):
def __repr__(self):
return '<instance Ob>'
ob = Ob()
@implementer(I2)
class Comp(object):
def __init__(self, context):
self.context = context
write('YYYYYYYYY')
for p in zope.__path__:
write('- %s' % p)
write('YYYYYYYYY')
import zope.component
zope.component.provideAdapter(Comp, (I1,), I2)
adapter = I2(ob)
write('ZZZZZZZZ')
assert adapter.__class__ is Comp
assert adapter.context is ob
|