except ImportError: readline = None try: from ptpython.repl import embed except: embed = None from zope.interface import directlyProvides from twisted.python import usage, filepath, log from twisted.python.reflect import qual from twisted.plugin import IPlugin from epsilon.hotfix import require require('twisted', 'filepath_copyTo') import axiom from axiom import store, attributes, userbase, dependency, errors from axiom.substore import SubStore from axiom.scripts import axiomatic from axiom.listversions import ListVersions from axiom import version from axiom.iaxiom import IVersion directlyProvides(version, IPlugin, IVersion) #placate pyflakes ListVersions
# -*- test-case-name: axiom.test.test_attributes,axiom.test.test_reference -*- import os from decimal import Decimal from epsilon import hotfix hotfix.require('twisted', 'filepath_copyTo') from zope.interface import implements from twisted.python import filepath from twisted.python.components import registerAdapter from epsilon.extime import Time from axiom.slotmachine import Attribute as inmemory from axiom.errors import NoCrossStoreReferences, BrokenReference from axiom.iaxiom import IComparison, IOrdering, IColumn, IQuery _NEEDS_FETCH = object() # token indicating that a value was not found __metaclass__ = type class _ComparisonOperatorMuxer: """ Collapse comparison operations into calls to a single method with varying arguments.
# -*- test-case-name: axiom.test.test_attributes -*- import os from decimal import Decimal from epsilon import hotfix hotfix.require('twisted', 'filepath_copyTo') from zope.interface import implements from twisted.python import filepath from twisted.python.components import registerAdapter from epsilon.extime import Time from axiom.slotmachine import Attribute as inmemory from axiom.errors import NoCrossStoreReferences from axiom.iaxiom import IComparison, IOrdering, IColumn, IQuery USING_APSW = False _NEEDS_FETCH = object() # token indicating that a value was not found __metaclass__ = type class _ComparisonOperatorMuxer: """
import getpass import code, os, traceback, sys try: import readline except ImportError: readline = None from zope.interface import directlyProvides from twisted.python import usage, filepath, log from twisted.python.reflect import qual from twisted.plugin import IPlugin from epsilon.hotfix import require require('twisted', 'filepath_copyTo') import axiom from axiom import store, attributes, userbase, dependency, errors from axiom.substore import SubStore from axiom.scripts import axiomatic from axiom.listversions import ListVersions from axiom import version from axiom.iaxiom import IVersion from axiom.upgrade import upgradeExplicitOid directlyProvides(version, IPlugin, IVersion) #placate pyflakes ListVersions
from xshtoom.sdp import SDP, MediaDescription from xshtoom.rtp.formats import PT_PCMU from sine.test.test_sip import TaskQueue from sine import sip, useragent, sipserver from twisted.internet import reactor, defer, task from twisted.trial import unittest from twisted.test.proto_helpers import StringTransport from twisted.cred.portal import Portal from zope.interface import implements from axiom import store, userbase, item, attributes from axiom.dependency import installOn from epsilon import juice, hotfix hotfix.require("twisted", "proto_helpers_stringtransport") exampleInvite = """INVITE sip:[email protected] SIP/2.0\r Via: SIP/2.0/UDP client.com:5060;branch=z9hG4bK74bf9\r Max-Forwards: 70\r From: Alice <sip:[email protected]>;tag=9fxced76sl\r To: Bob <sip:[email protected]>\r Call-ID: [email protected]\r CSeq: 1 INVITE\r Contact: <sip:[email protected]>\r \r v=0\r o=alice 2890844526 2890844526 IN IP4 server.com\r s=-\r c=IN IP4 10.0.0.1\r t=0 0\r m=audio 49172 RTP/AVP 0\r a=rtpmap:0 PCMU/8000\r
""" This module includes tests for the L{xmantissa.scrolltable} module. """ from re import escape from epsilon.hotfix import require require("twisted", "trial_assertwarns") from zope.interface import implements from twisted.trial import unittest from twisted.trial.util import suppress as SUPPRESS from axiom.store import Store from axiom.item import Item from axiom.attributes import integer, text from axiom.dependency import installOn from axiom.test.util import QueryCounter from xmantissa.webapp import PrivateApplication from xmantissa.ixmantissa import IWebTranslator, IColumn from xmantissa.error import Unsortable from xmantissa.scrolltable import (InequalityModel, ScrollableView, ScrollingFragment, ScrollingElement, SequenceScrollingFragment, StoreIDSequenceScrollingFragment, AttributeColumn, UnsortableColumnWrapper, UnsortableColumn)
from epsilon import hotfix hotfix.require('twisted', 'delayedcall_seconds') hotfix.require('twisted', 'timeoutmixin_calllater') import os, StringIO from twisted.trial import unittest from twisted.internet import error, base from twisted.python import failure, filepath from epsilon.scripts import benchmark from epsilon import juice class DiskstatTestCase(unittest.TestCase): def testDiskLineParser(self): """ Test the parsing of a single line into a single diststat instance. """ s = ("3 0 hda 267481 3913 3944418 1625467 3392405 3781877 58210592 " "150845143 0 6136300 153333793") device, stat = benchmark.parseDiskStatLine(s) self.assertEquals(device, 'hda') self.assertEquals(stat.readCount, 267481) self.assertEquals(stat.mergedReadCount, 3913) self.assertEquals(stat.readSectorCount, 3944418) self.assertEquals(stat.readMilliseconds, 1625467) self.assertEquals(stat.writeCount, 3392405) self.assertEquals(stat.mergedWriteCount, 3781877) self.assertEquals(stat.writeSectorCount, 58210592)
# -*- test-case-name: xquotient.test.test_grabber -*- from epsilon import hotfix hotfix.require('twisted', 'deferredgenerator_tfailure') import time, datetime from twisted.mail import pop3, pop3client from twisted.internet import protocol, defer, ssl, error from twisted.python import log, components, failure from twisted.protocols import policies from nevow import loaders, tags, athena from nevow.flat import flatten from nevow.athena import expose from epsilon import descriptor, extime from axiom import item, attributes, iaxiom from axiom.dependency import dependsOn from axiom.upgrade import registerUpgrader from xmantissa import ixmantissa, webtheme, liveform from xmantissa.webapp import PrivateApplication from xmantissa.scrolltable import ScrollingFragment, AttributeColumn, TYPE_FRAGMENT from xmantissa.stats import BandwidthMeasuringFactory from xquotient.mail import DeliveryAgent
# -*- test-case-name: xquotient.test.test_grabber -*- from epsilon import hotfix hotfix.require('twisted', 'deferredgenerator_tfailure') import time, datetime from twisted.mail import pop3, pop3client from twisted.internet import protocol, defer, ssl, error from twisted.python import log, components, failure from twisted.protocols import policies from nevow import loaders, tags, athena from nevow.flat import flatten from nevow.athena import expose from epsilon import descriptor, extime from axiom import item, attributes, iaxiom from axiom.dependency import dependsOn from axiom.upgrade import registerUpgrader from xmantissa import ixmantissa, webtheme, liveform from xmantissa.webapp import PrivateApplication from xmantissa.scrolltable import ScrollingFragment, AttributeColumn, TYPE_FRAGMENT from xmantissa.stats import BandwidthMeasuringFactory from xquotient.mail import DeliveryAgent PROTOCOL_LOGGING = True
from epsilon import hotfix hotfix.require('twisted', 'trial_assertwarns') import sha from zope.interface import implements from zope.interface.verify import verifyObject try: from cssutils import CSSParser CSSParser except ImportError: CSSParser = None from twisted.python.components import registerAdapter from twisted.internet.address import IPv4Address from twisted.trial.unittest import TestCase from twisted.trial import util from twisted.python.filepath import FilePath from nevow import tags from nevow.flat import flatten from nevow.context import WebContext from nevow.testutil import FakeRequest from nevow.url import URL from nevow.inevow import IResource, IRequest from nevow.rend import WovenContext, NotFound from nevow.athena import LivePage, LiveElement, AthenaModule, jsDeps from nevow.guard import LOGIN_AVATAR from nevow.loaders import stan
from epsilon import hotfix hotfix.require('twisted', 'trial_assertwarns') from hashlib import sha1 from zope.interface import implements from zope.interface.verify import verifyObject try: from cssutils import CSSParser CSSParser except ImportError: CSSParser = None from twisted.python.components import registerAdapter from twisted.internet.address import IPv4Address from twisted.trial.unittest import TestCase from twisted.trial import util from twisted.python.filepath import FilePath from nevow import tags from nevow.flat import flatten from nevow.context import WebContext from nevow.testutil import FakeRequest from nevow.url import URL from nevow.inevow import IResource, IRequest from nevow.rend import WovenContext, NotFound from nevow.athena import LivePage, LiveElement, AthenaModule, jsDeps from nevow.guard import LOGIN_AVATAR from nevow.loaders import stan
from epsilon.hotfix import require require("twisted", "trial_assertwarns") from axiom.store import Store from axiom.item import Item from axiom.attributes import integer, text, AND from twisted.trial import unittest from xmantissa import tdb, scrolltable class X(Item): typeName = 'test_tdb_model_dummy' schemaVersion = 1 number = integer() textNumber = text() phoneticDigits = text() digits = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
# Copyright (c) 2008 Divmod. See LICENSE for details. """ Package for plugins for interfaces in Axiom. """ from epsilon.hotfix import require require('twisted', 'plugin_package_paths') from twisted.plugin import pluginPackagePaths __path__.extend(pluginPackagePaths(__name__)) __all__ = []
from epsilon import hotfix hotfix.require('twisted', 'delayedcall_seconds') hotfix.require('twisted', 'timeoutmixin_calllater') import os, io from twisted.trial import unittest from twisted.internet import error, base from twisted.python import failure, filepath from epsilon.scripts import benchmark from epsilon import juice try: filepath.FilePath('/proc/diskstats').open().close() filepath.FilePath('/proc/self/mounts').open().close() except IOError: hasProc = False else: hasProc = True class DiskstatTestCase(unittest.TestCase): if not hasProc: skip = 'epsilon.benchmark requires access to /proc'