Exemple #1
0
def setUp(test):
    cleanup.setUp()
    data_dir = os.path.join(os.path.dirname(__file__), 'testfiles')

    test.globs['testFilePath'] = os.path.join(data_dir, 'test.txt')
    test.globs['nullChecker'] = NamesChecker()
    test.globs['TestRequest'] = TestRequest
    def setUp(self):
        cleanup.setUp()
        data_dir = os.path.join(os.path.dirname(__file__), 'testfiles')

        self.testFilePath = os.path.join(data_dir, 'test.txt')
        self.nullChecker = NamesChecker()
        provideAdapter(MyETag)
    def setUp(self):
        cleanup.setUp()
        data_dir = os.path.join(os.path.dirname(__file__), 'testfiles')

        self.testFilePath = os.path.join(data_dir, 'test.txt')
        self.nullChecker = NamesChecker()
        provideAdapter(MyETag)
Exemple #4
0
def setUp(session_data_container_class=None):
    from io import StringIO
    from zope.testing import cleanup
    from zope.component import provideAdapter
    from zope.component import provideUtility
    from zope.publisher.http import HTTPRequest
    from zope.publisher.interfaces import IRequest
    from zope.session.http import CookieClientIdManager
    from zope.session.interfaces import IClientId
    from zope.session.interfaces import IClientIdManager
    from zope.session.interfaces import ISession
    from zope.session.interfaces import ISessionDataContainer
    from zope.session.session import ClientId
    from zope.session.session import PersistentSessionDataContainer
    from zope.session.session import Session
    cleanup.setUp()
    if session_data_container_class is None:
        session_data_container_class = PersistentSessionDataContainer
    provideAdapter(ClientId, (IRequest,), IClientId)
    provideAdapter(Session, (IRequest,), ISession)
    provideUtility(CookieClientIdManager(), IClientIdManager)
    sdc = session_data_container_class()
    for product_id in ('', 'products.foo', 'products.bar', 'products.baz'):
        provideUtility(sdc, ISessionDataContainer, product_id)
    request = HTTPRequest(StringIO(), {}, None)
    return request
Exemple #5
0
def setUp(test):
    cleanup.setUp()
    eventtesting.setUp()
    provideAdapter(AttributeAnnotations)
    provideAdapter(AnnotationPrincipalRoleManager, adapts=(IAnnotatable, ))
    provideAdapter(Ownership)
    provideHandler(setOwner)
    provideUtility(principalRegistry, IAuthentication)
    test.globs = {'authentication': principalRegistry}
Exemple #6
0
def setUp(session_data_container_class=PersistentSessionDataContainer):
    cleanup.setUp()
    zope.component.provideAdapter(ClientId, (IRequest,), IClientId)
    zope.component.provideAdapter(Session, (IRequest,), ISession)
    zope.component.provideUtility(CookieClientIdManager(), IClientIdManager)
    sdc = session_data_container_class()
    for product_id in ('', 'products.foo', 'products.bar', 'products.baz'):
        zope.component.provideUtility(sdc, ISessionDataContainer, product_id)
    request = HTTPRequest(StringIO(), {}, None)
    return request
    def setUp(self):
        from zope.testing import cleanup
        from zope.interface import implementer
        from zope.annotation.attribute import AttributeAnnotations
        from zope.annotation.interfaces import IAttributeAnnotatable

        cleanup.setUp()

        @implementer(IAttributeAnnotatable)
        class Dummy(object):
            pass

        self.obj = Dummy()
        self.annotations = AttributeAnnotations(self.obj)
    def setUp(self):
        from zope.testing import cleanup
        from zope.interface import implementer
        from zope.annotation.attribute import AttributeAnnotations
        from zope.annotation.interfaces import IAttributeAnnotatable

        cleanup.setUp()

        @implementer(IAttributeAnnotatable)
        class Dummy(object):
            pass

        self.obj = Dummy()
        self.annotations = AttributeAnnotations(self.obj)
Exemple #9
0
def setUp(test):
    cleanup.setUp()
    eventtesting.setUp()

    from zope.browserpage.metaconfigure import registerType
    from zope.contentprovider import tales
    registerType('provider', tales.TALESProviderExpression)

    # Make sure we are always reloading page template files ;-)
    global mtime_func
    mtime_func = os.path.getmtime
    def number(x):
        global counter
        counter += 1
        return counter
    os.path.getmtime = number
Exemple #10
0
def setUp(test):
    cleanup.setUp()
    eventtesting.setUp()
    traversingSetUp()

    # resource namespace setup
    from zope.traversing.interfaces import ITraversable
    from zope.traversing.namespace import resource
    zope.component.provideAdapter(
        resource, (None,), ITraversable, name = "resource")
    zope.component.provideAdapter(
        resource, (None, None), ITraversable, name = "resource")

    from zope.browserpage import metaconfigure
    from zope.contentprovider import tales
    metaconfigure.registerType('provider', tales.TALESProviderExpression)
def test_suite():
    return unittest.TestSuite(
        (doctest.DocFileSuite('../README.txt',
                              setUp=lambda test: cleanup.setUp(),
                              tearDown=lambda test: cleanup.tearDown(),
                              globs={'pprint': pprint.pprint},
                              optionflags=doctest.NORMALIZE_WHITESPACE), ))
Exemple #12
0
def test_suite():
    return unittest.TestSuite(
        (
            doctest.DocTestSuite(
                "zope.browsermenu.field", setUp=lambda test: cleanup.setUp(), tearDown=lambda test: cleanup.tearDown()
            ),
        )
    )
Exemple #13
0
def test_suite():
    return unittest.TestSuite((
        doctest.DocFileSuite('../README.txt',
                             setUp=lambda test:cleanup.setUp(),
                             tearDown=lambda test:cleanup.tearDown(),
                             globs={'pprint': pprint.pprint},
                             optionflags=doctest.NORMALIZE_WHITESPACE),
        ))
Exemple #14
0
def test_suite():
    return unittest.TestSuite((
        unittest.defaultTestLoader.loadTestsFromName(__name__),
        doctest.DocTestSuite(
            'zope.browsermenu.field',
            setUp=lambda test: cleanup.setUp(),
            tearDown=lambda test: cleanup.tearDown()),
    ))
Exemple #15
0
def setUp(test):
    cleanup.setUp()
    eventtesting.setUp()

    from zope.browserpage.metaconfigure import registerType
    from zope.contentprovider import tales
    registerType('provider', tales.TALESProviderExpression)

    # Make sure we are always reloading page template files ;-)
    global mtime_func
    mtime_func = os.path.getmtime

    def number(x):
        global counter
        counter += 1
        return counter

    os.path.getmtime = number
Exemple #16
0
def doctestSetUp(test):
    cleanup.setUp()
    eventtesting.setUp()
    traversingSetUp()

    # resource namespace setup
    from zope.traversing.interfaces import ITraversable
    from zope.traversing.namespace import resource
    zope.component.provideAdapter(resource, (None, ),
                                  ITraversable,
                                  name="resource")
    zope.component.provideAdapter(resource, (None, None),
                                  ITraversable,
                                  name="resource")

    from zope.browserpage import metaconfigure
    from zope.contentprovider import tales
    metaconfigure.registerType('provider', tales.TALESProviderExpression)
def test_suite():
    return unittest.TestSuite((
        unittest.defaultTestLoader.loadTestsFromName(__name__),
        doctest.DocFileSuite('../README.txt',
                             setUp=lambda test: cleanup.setUp(),
                             tearDown=lambda test: cleanup.tearDown(),
                             globs={'pprint': pprint.pprint},
                             checker=checker,
                             optionflags=doctest.NORMALIZE_WHITESPACE),
    ))
def test_suite():
    return unittest.TestSuite((
        unittest.defaultTestLoader.loadTestsFromName(__name__),
        doctest.DocFileSuite(
            '../README.txt',
            setUp=lambda test: cleanup.setUp(),
            tearDown=lambda test: cleanup.tearDown(),
            globs={'pprint': pprint.pprint},
            checker=checker,
            optionflags=doctest.NORMALIZE_WHITESPACE),
    ))
def setUp(test):
    cleanup.setUp()
    component.provideAdapter(AttributeAnnotations)
    testing.setUpDublinCore()
def setUp(test):
    cleanup.setUp()
    testing.setUp()
    zope.component.provideAdapter(view, (None, None), ITraversable, name="view")
    zope.component.provideAdapter(zope.browserresource.file.FileETag)
Exemple #21
0
def setUp(test=None):
    cleanup.setUp()
Exemple #22
0
 def setUp(_test):
     cleanup.setUp()
def setUp(test=None):
    cleanup.setUp()
    component.provideAdapter(AttributeAnnotations)
Exemple #24
0
def test_suite():
    return unittest.TestSuite((
        doctest.DocTestSuite('zope.browsermenu.field',
                     setUp=lambda test:cleanup.setUp(),
                     tearDown=lambda test:cleanup.tearDown()),
        ))
def setUp(test):
    cleanup.setUp()
Exemple #26
0
def setUp(test):
    cleanup.setUp()
    component.provideAdapter(AttributeAnnotations)
    testing.setUpDublinCore()
Exemple #27
0
def setUp(_test=None):
    gc.collect()
    cleanup.setUp()
    if docs_dir not in sys.path:
        sys.path.insert(0, docs_dir)
def setUp(test=None):
    cleanup.setUp()
    component.provideAdapter(AttributeAnnotations)