Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

made IonTestCase and all tests PEP8 compliant

  • Loading branch information...
commit 5ea10a77e029ff314b61dd280d554238ec6de894 1 parent 2f00342
@mmeisinger mmeisinger authored
View
3  README.txt
@@ -85,7 +85,8 @@ Change log:
2010-05-06:
- Refactored the BaseProcess class.
- You can now do RPC directly from the process, via self.rpc_send without
- the need for an RpcClient
+ the need for an RpcClient. Works even with other messages coming in at the
+ same time (using the conv-id)
- Added aliases: self.send, self.reply (use these now)
- Process instance can be spawned via self.spawn()
- Provided an easier to use BaseServiceClient, which uses a default service
View
4 ion/core/test/test_baseprocess.py
@@ -29,11 +29,11 @@ class BaseProcessTest(IonTestCase):
@defer.inlineCallbacks
def setUp(self):
- yield self._startContainer()
+ yield self._start_container()
@defer.inlineCallbacks
def tearDown(self):
- yield self._stopContainer()
+ yield self._stop_container()
@defer.inlineCallbacks
def test_process(self):
View
16 ion/core/test/test_bootstrap.py
@@ -31,32 +31,32 @@ class BootstrapTest1(IonTestCase):
"""
@defer.inlineCallbacks
- def test_startContainer(self):
- yield self._startContainer()
+ def test_start_container(self):
+ yield self._start_container()
logging.info("Started magnet container")
- yield self._stopContainer()
+ yield self._stop_container()
@defer.inlineCallbacks
def test_startContainerAndServices(self):
- yield self._startContainer()
- yield self._startCoreServices()
+ yield self._start_container()
+ yield self._start_core_services()
logging.info("Started magnet and core services")
- yield self._stopContainer()
+ yield self._stop_container()
class BootstrapTest2(IonTestCase):
@defer.inlineCallbacks
def setUp(self):
- yield self._startContainer()
+ yield self._start_container()
@defer.inlineCallbacks
def tearDown(self):
- yield self._stopContainer()
+ yield self._stop_container()
def test_1(self):
pass
View
14 ion/core/test/test_worker.py
@@ -21,11 +21,11 @@ class WorkerTest(IonTestCase):
@defer.inlineCallbacks
def setUp(self):
- yield self._startContainer()
+ yield self._start_container()
@defer.inlineCallbacks
def tearDown(self):
- yield self._stopContainer()
+ yield self._stop_container()
@defer.inlineCallbacks
def _test_basic(self):
@@ -35,7 +35,7 @@ def _test_basic(self):
{'name':'hello2','module':'ion.services.hello_service','class':'HelloService'},
]
- yield self._spawnProcesses(workers)
+ yield self._spawn_processes(workers)
@defer.inlineCallbacks
def test_worker_queue(self):
@@ -46,8 +46,8 @@ def test_worker_queue(self):
{'name':'workerProc2','module':'ion.core.worker','class':'WorkerProcess','spawnargs':{'service-name':'worker1','scope':'local'}},
]
- yield self._declareMessaging(messaging)
- yield self._spawnProcesses(workers)
+ yield self._declare_messaging(messaging)
+ yield self._spawn_processes(workers)
sup = yield self.procRegistry.get("bootstrap")
logging.info("Supervisor: "+repr(sup))
@@ -77,8 +77,8 @@ def test_fanout(self):
{'name':'fanoutProc2','module':'ion.core.worker','class':'WorkerProcess','spawnargs':{'service-name':'fanout1','scope':'local'}},
]
- yield self._declareMessaging(messaging)
- yield self._spawnProcesses(workers)
+ yield self._declare_messaging(messaging)
+ yield self._spawn_processes(workers)
sup = yield self.procRegistry.get("bootstrap")
logging.info("Supervisor: "+repr(sup))
View
6 ion/data/test/test_fetcher.py
@@ -17,11 +17,11 @@
class DatastoreTest(IonTestCase):
@defer.inlineCallbacks
def setUp(self):
- yield self._startContainer()
+ yield self._start_container()
@defer.inlineCallbacks
def tearDown(self):
- yield self._stopContainer()
+ yield self._stop_container()
@defer.inlineCallbacks
def test_single_get(self):
@@ -31,7 +31,7 @@ def test_single_get(self):
"""
services = [{'name':'fetcher', 'module':'ion.data.fetcher',
'class': 'FetcherService'},]
- yield self._spawnProcesses(services)
+ yield self._spawn_processes(services)
dest = yield self.procRegistry.get('fetcher')
logging.debug('fetcher: '+repr(dest))
View
6 ion/data/test/test_objstore.py
@@ -185,11 +185,11 @@ class ObjectStoreServiceTest(IonTestCase):
"""
@defer.inlineCallbacks
def setUp(self):
- yield self._startContainer()
+ yield self._start_container()
@defer.inlineCallbacks
def tearDown(self):
- yield self._stopContainer()
+ yield self._stop_container()
@defer.inlineCallbacks
@@ -199,7 +199,7 @@ def test_put(self):
#{'name':'objstoreSvc2','module':'ion.data.objstore','class':'ObjectStoreService'},
]
- yield bootstrap.bootstrap(None, services)
+ yield self._spawn_processes(services)
sup = yield base_process.procRegistry.get("bootstrap")
logging.info("Supervisor: "+repr(sup))
View
8 ion/play/test/test_hello.py
@@ -22,11 +22,11 @@ class HelloTest(IonTestCase):
@defer.inlineCallbacks
def setUp(self):
- yield self._startContainer()
+ yield self._start_container()
@defer.inlineCallbacks
def tearDown(self):
- yield self._stopContainer()
+ yield self._stop_container()
@defer.inlineCallbacks
def test_hello(self):
@@ -35,9 +35,7 @@ def test_hello(self):
{'name':'hello1','module':'ion.play.hello_service','class':'HelloService'},
]
- yield self._spawnProcesses(services)
-
- sup = yield self.procRegistry.get("bootstrap")
+ sup = yield self._spawn_processes(services)
logging.info("Supervisor: "+repr(sup))
hsid = yield self.procRegistry.get("hello1")
View
6 ion/services/coi/test/test_resource_registry.py
@@ -54,12 +54,12 @@ class ResourceRegistryTest(IonTestCase):
@defer.inlineCallbacks
def setUp(self):
- yield self._startContainer()
- yield self._startCoreServices()
+ yield self._start_container()
+ yield self._start_core_services()
@defer.inlineCallbacks
def tearDown(self):
- yield self._stopContainer()
+ yield self._stop_container()
@defer.inlineCallbacks
def test_serviceReg(self):
View
8 ion/services/coi/test/test_service_registry.py
@@ -21,14 +21,12 @@ class ServiceRegistryClientTest(IonTestCase):
@defer.inlineCallbacks
def setUp(self):
- IonTestCase.setUp(self)
- yield self._startContainer()
- yield self._startCoreServices()
+ yield self._start_container()
+ yield self._start_core_cervices()
@defer.inlineCallbacks
def tearDown(self):
- IonTestCase.tearDown(self)
- yield self._stopContainer()
+ yield self._stop_container()
def test_serviceReg(self):
src = None
View
8 ion/services/dm/test/test_datapubsub.py
@@ -46,11 +46,11 @@ class PubSubTest(IonTestCase):
@defer.inlineCallbacks
def setUp(self):
- yield self._startContainer()
+ yield self._start_container()
@defer.inlineCallbacks
def tearDown(self):
- yield self._stopContainer()
+ yield self._stop_container()
@defer.inlineCallbacks
def test_pubsub(self):
@@ -58,7 +58,7 @@ def test_pubsub(self):
{'name':'data_pubsub','module':'ion.services.dm.datapubsub','class':'DataPubsubService'},
]
- sup = yield self._spawnProcesses(services)
+ sup = yield self._spawn_processes(services)
dps = yield self.procRegistry.get("data_pubsub")
logging.info("DataPubsubservice: "+repr(dps))
@@ -104,7 +104,7 @@ def test_chainprocess(self):
{'name':'data_pubsub','module':'ion.services.dm.datapubsub','class':'DataPubsubService'},
]
- sup = yield self._spawnProcesses(services)
+ sup = yield self._spawn_processes(services)
dps = yield self.procRegistry.get("data_pubsub")
logging.info("DataPubsubservice: "+repr(dps))
View
14 ion/test/iontest.py
@@ -29,7 +29,7 @@ class IonTestCase(unittest.TestCase):
procRegistry = base_process.procRegistry
@defer.inlineCallbacks
- def _startContainer(self):
+ def _start_container(self):
mopt = {}
mopt['broker_host'] = 'amoeba.ucsd.edu'
mopt['broker_port'] = 5672
@@ -42,14 +42,12 @@ def _startContainer(self):
self.procRegistry = base_process.procRegistry
logging.info("============Magnet container started, "+repr(self.cont_conn))
- _startMagnet = _startContainer
-
@defer.inlineCallbacks
- def _startCoreServices(self):
+ def _start_core_services(self):
yield bootstrap.bootstrap(None, bootstrap.ion_core_services)
logging.info("============Core ION services started============")
- def _stopContainer(self):
+ def _stop_container(self):
logging.info("Closing ION container")
self.cont_conn.transport.loseConnection()
container.Container._started = False
@@ -57,10 +55,10 @@ def _stopContainer(self):
bootstrap.reset_container()
logging.info("============ION container closed============")
- _stopMagnet = _stopContainer
- def _declareMessaging(self, messaging):
+ def _declare_messaging(self, messaging):
return bootstrap.bs_messaging(messaging)
- def _spawnProcesses(self, procs):
+ def _spawn_processes(self, procs):
return bootstrap.bs_processes(procs)
+

0 comments on commit 5ea10a7

Please sign in to comment.
Something went wrong with that request. Please try again.