Commits

Aaron Terrell (Enus)  committed a5f4b95

moved doctests to tests/doctests, updated setup and testDocTests accordingly

  • Participants
  • Parent commits 45e457d

Comments (0)

Files changed (7)

File pyogp/lib/base/tests/caps.txt

-
-"""
-Contributors can be viewed at:
-http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/trunk/CONTRIBUTORS.txt 
-
-$LicenseInfo:firstyear=2008&license=apachev2$
-
-Copyright 2009, Linden Research, Inc.
-
-Licensed under the Apache License, Version 2.0.
-You may obtain a copy of the License at:
-    http://www.apache.org/licenses/LICENSE-2.0
-or in 
-    http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/LICENSE.txt
-
-$/LicenseInfo$
-"""
-
-The Capabilities component
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The Capabilities component basically gives us two objects: a Capability 
-and a SeedCapability.
-
-We can instantiate a SeedCapability like this:
-
-    >>> from pyogp.lib.base.tests.mockup_client import MockupClient
-    >>> from pyogp.lib.base.caps import SeedCapability, Capability
-    >>> from pyogp.lib.base.tests.base import MockAgentDomain
-    >>> client = MockupClient(MockAgentDomain())
-    >>> seed = SeedCapability('seed', 'http://127.0.0.1:12345/seed_cap', client)
-
-We assume that we got the seed capability URL itself from login or some other service.
-
-We can now ask this SeedCapability object for new capabilities:
-
-    >>> caps = seed.get(['some_capability', 'some_other'])
-
-The result is a dictionary object:
-
-    >>> len(caps.keys())
-    2
-
-whose contents are:
-
-    >>> caps['some_capability']
-    <Capability 'some_capability' for http://localhost:12345/cap/some_capability>
-    >>> caps['some_other']
-    <Capability 'some_other' for http://localhost:12345/cap/some_other>
-
-Let's store the some_capability cap in a variable:
-
-    >>> some_cap = caps['some_capability']
-
-The capability now can be simply called with a payload and returns some data itself.
-
-First we call it:
-
-    >>> data = some_cap.POST({'a':'b'})
-
-And now we can check the data:
-
-    >>> data['something']
-    'else'
-    >>> data['some']
-    12345
-
-This data here is provided by the mockup server for testing.
-
-Internals
-~~~~~~~~~
-
-Each capability stores it's name and public URL which it is instantiated with. 
-We can access these like this:
-
-    >>> some_cap.name
-    'some_capability'
-
-    >>> some_cap.public_url
-    'http://localhost:12345/cap/some_capability'
-
-As we can see, it's not a secret URL in this mockup case but in production it will be.
-
-We can of course also just instantiate some capability directly:
-
-    >>> cap = Capability("cap", "http://localhost:12345/cap/some_capability", client)
-
-and retrieve it via GET:
-
-    >>> cap.GET()
-    {'some': 12345, 'something': 'else'}
-
-or post something to it (the demo will simply update the base dict):
-
-    >>> cap.POST({'Tao':'Takashi'})
-    {'Tao': 'Takashi', 'some': 12345, 'something': 'else'}
-
-Testing errors
-~~~~~~~~~~~~~~
-
-Now we can test what happens to our code when the server returns a wrong content type.
-In this case it should not find a deserializer and say so::
-
-    >>> seed = SeedCapability('seed', 'http://127.0.0.1:12345/seed_cap_wrong_content_type', client)
-    >>> cap = seed.get(['some_capability'])
-    Traceback (most recent call last):
-    ...
-    DeserializerNotFound: deserialization for 'text/foobar' not supported
-
-Try the same for GET:
-
-    >>> cap = Capability('test','http://127.0.0.1:12345/cap_wrong_content_type', client)
-    >>> cap.GET()
-    Traceback (most recent call last):
-    ...
-    DeserializerNotFound: deserialization for 'text/foobar' not supported
-
-Now we test if network errors are handled correctly::
-
-    >>> cap = Capability('test','http://127.0.0.1:12345/cap/error', client)
-    >>> cap.POST({'test':'testing'})
-    Traceback (most recent call last):
-    ...
-    ResourceError: Error using 'POST' on resource 'http://127.0.0.1:12345/cap/error': Internal Server Error (500)
-
-And some 404:
-
-    >>> cap = Capability('test','http://127.0.0.1:12345/cap/unkown', client)
-    >>> cap.POST({'test':'testing'})
-    Traceback (most recent call last):
-    ...
-    ResourceNotFound: http://127.0.0.1:12345/cap/unkown
-
-
-
-
-

File pyogp/lib/base/tests/doctests/__init__.py

+
+"""
+Contributors can be viewed at:
+http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/trunk/CONTRIBUTORS.txt 
+
+$LicenseInfo:firstyear=2008&license=apachev2$
+
+Copyright 2009, Linden Research, Inc.
+
+Licensed under the Apache License, Version 2.0.
+You may obtain a copy of the License at:
+    http://www.apache.org/licenses/LICENSE-2.0
+or in 
+    http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/LICENSE.txt
+
+$/LicenseInfo$
+"""
+
+
+

File pyogp/lib/base/tests/doctests/caps.txt

+
+"""
+Contributors can be viewed at:
+http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/trunk/CONTRIBUTORS.txt 
+
+$LicenseInfo:firstyear=2008&license=apachev2$
+
+Copyright 2009, Linden Research, Inc.
+
+Licensed under the Apache License, Version 2.0.
+You may obtain a copy of the License at:
+    http://www.apache.org/licenses/LICENSE-2.0
+or in 
+    http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/LICENSE.txt
+
+$/LicenseInfo$
+"""
+
+The Capabilities component
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The Capabilities component basically gives us two objects: a Capability 
+and a SeedCapability.
+
+We can instantiate a SeedCapability like this:
+
+    >>> from pyogp.lib.base.tests.mockup_client import MockupClient
+    >>> from pyogp.lib.base.caps import SeedCapability, Capability
+    >>> from pyogp.lib.base.tests.base import MockAgentDomain
+    >>> client = MockupClient(MockAgentDomain())
+    >>> seed = SeedCapability('seed', 'http://127.0.0.1:12345/seed_cap', client)
+
+We assume that we got the seed capability URL itself from login or some other service.
+
+We can now ask this SeedCapability object for new capabilities:
+
+    >>> caps = seed.get(['some_capability', 'some_other'])
+
+The result is a dictionary object:
+
+    >>> len(caps.keys())
+    2
+
+whose contents are:
+
+    >>> caps['some_capability']
+    <Capability 'some_capability' for http://localhost:12345/cap/some_capability>
+    >>> caps['some_other']
+    <Capability 'some_other' for http://localhost:12345/cap/some_other>
+
+Let's store the some_capability cap in a variable:
+
+    >>> some_cap = caps['some_capability']
+
+The capability now can be simply called with a payload and returns some data itself.
+
+First we call it:
+
+    >>> data = some_cap.POST({'a':'b'})
+
+And now we can check the data:
+
+    >>> data['something']
+    'else'
+    >>> data['some']
+    12345
+
+This data here is provided by the mockup server for testing.
+
+Internals
+~~~~~~~~~
+
+Each capability stores it's name and public URL which it is instantiated with. 
+We can access these like this:
+
+    >>> some_cap.name
+    'some_capability'
+
+    >>> some_cap.public_url
+    'http://localhost:12345/cap/some_capability'
+
+As we can see, it's not a secret URL in this mockup case but in production it will be.
+
+We can of course also just instantiate some capability directly:
+
+    >>> cap = Capability("cap", "http://localhost:12345/cap/some_capability", client)
+
+and retrieve it via GET:
+
+    >>> cap.GET()
+    {'some': 12345, 'something': 'else'}
+
+or post something to it (the demo will simply update the base dict):
+
+    >>> cap.POST({'Tao':'Takashi'})
+    {'Tao': 'Takashi', 'some': 12345, 'something': 'else'}
+
+Testing errors
+~~~~~~~~~~~~~~
+
+Now we can test what happens to our code when the server returns a wrong content type.
+In this case it should not find a deserializer and say so::
+
+    >>> seed = SeedCapability('seed', 'http://127.0.0.1:12345/seed_cap_wrong_content_type', client)
+    >>> cap = seed.get(['some_capability'])
+    Traceback (most recent call last):
+    ...
+    DeserializerNotFound: deserialization for 'text/foobar' not supported
+
+Try the same for GET:
+
+    >>> cap = Capability('test','http://127.0.0.1:12345/cap_wrong_content_type', client)
+    >>> cap.GET()
+    Traceback (most recent call last):
+    ...
+    DeserializerNotFound: deserialization for 'text/foobar' not supported
+
+Now we test if network errors are handled correctly::
+
+    >>> cap = Capability('test','http://127.0.0.1:12345/cap/error', client)
+    >>> cap.POST({'test':'testing'})
+    Traceback (most recent call last):
+    ...
+    ResourceError: Error using 'POST' on resource 'http://127.0.0.1:12345/cap/error': Internal Server Error (500)
+
+And some 404:
+
+    >>> cap = Capability('test','http://127.0.0.1:12345/cap/unkown', client)
+    >>> cap.POST({'test':'testing'})
+    Traceback (most recent call last):
+    ...
+    ResourceNotFound: http://127.0.0.1:12345/cap/unkown
+
+
+
+
+

File pyogp/lib/base/tests/doctests/message_handler.txt

+
+"""
+Contributors can be viewed at:
+http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/trunk/CONTRIBUTORS.txt 
+
+$LicenseInfo:firstyear=2008&license=apachev2$
+
+Copyright 2009, Linden Research, Inc.
+
+Licensed under the Apache License, Version 2.0.
+You may obtain a copy of the License at:
+    http://www.apache.org/licenses/LICENSE-2.0
+or in 
+    http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/LICENSE.txt
+
+$/LicenseInfo$
+"""
+
+MessageHandler
+~~~~~~~~~~~~~~
+
+The basic message handling event/callbackcase
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+First, initialize the packet handler
+    >>> from pyogp.lib.base.message.message_handler import MessageHandler
+    >>> message_handler = MessageHandler()
+
+How about a mock callback handler
+    >>> def callback(packet): print packet
+
+    >>> onStartPingCheck_received = message_handler.register("StartPingCheck")
+    >>> onStartPingCheck_received.subscribe(callback)
+
+Stage a packet
+    >>> from pyogp.lib.base.message.message import Message
+    >>> packet = Message('StartPingCheck')
+
+Fire the event, it returns a Message instance
+    >>> type(message_handler.handle(packet))
+    >>> Message
+

File pyogp/lib/base/tests/message_handler.txt

-
-"""
-Contributors can be viewed at:
-http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/trunk/CONTRIBUTORS.txt 
-
-$LicenseInfo:firstyear=2008&license=apachev2$
-
-Copyright 2009, Linden Research, Inc.
-
-Licensed under the Apache License, Version 2.0.
-You may obtain a copy of the License at:
-    http://www.apache.org/licenses/LICENSE-2.0
-or in 
-    http://svn.secondlife.com/svn/linden/projects/2008/pyogp/lib/base/LICENSE.txt
-
-$/LicenseInfo$
-"""
-
-MessageHandler
-~~~~~~~~~~~~~~
-
-The basic message handling event/callbackcase
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-First, initialize the packet handler
-    >>> from pyogp.lib.base.message.message_handler import MessageHandler
-    >>> message_handler = MessageHandler()
-
-How about a mock callback handler
-    >>> def callback(packet): print packet
-
-    >>> onStartPingCheck_received = message_handler.register("StartPingCheck")
-    >>> onStartPingCheck_received.subscribe(callback)
-
-Stage a packet
-    >>> from pyogp.lib.base.message.message import Message
-    >>> packet = Message('StartPingCheck')
-
-Fire the event, it returns a Message instance
-    >>> type(message_handler.handle(packet))
-    >>> Message
-

File pyogp/lib/base/tests/testDocTests.py

             doctest.DocFileSuite(
                 "caps.txt",
                 "message_handler.txt",
-                package="pyogp.lib.base.tests",
+                package="pyogp.lib.base.tests.doctests",
                 setUp = setUp,
                 tearDown = tearDown,
                 optionflags=optionflags,
      url='http://wiki.secondlife.com/wiki/Pyogp',
      license='Apache2',
      packages=find_packages(exclude=['ez_setup']),
-     package_data={'pyogp.lib.base': ['message/data/message_template.msg', 'message/data/message.xml']},
+     package_data={'pyogp.lib.base': ['message/data/message_template.msg', 'message/data/message.xml', 'tests/doctests/*.*']},
      namespace_packages=['pyogp', 'pyogp.lib'],
      zip_safe=False,
      install_requires=[