Commit b466b315 authored by Philipp Gast's avatar Philipp Gast
Browse files

preparations for merge with branch 74

parent b0c097ee
......@@ -97,7 +97,7 @@ class MplClient2():
if status_sig.value:
if debug:
print('request type ',
org_query.queryType,
org_query.query_type,
' successful')
return True
else:
......@@ -136,7 +136,7 @@ class MplClient2():
if not status:
print('something went wrong with the '
'sending of listRemoteData request...')
answer = self.waitForSignal()
answer = self.wait_for_signal()
self.disconnect()
......@@ -155,7 +155,7 @@ class MplClient2():
if not status:
print('something went wrong with the '
'sending of listRemoteFig request...')
answer = self.waitForSignal()
answer = self.wait_for_signal()
self.disconnect()
......@@ -196,8 +196,8 @@ class MplClient2():
# create a Signal of type Query with args
query = Query(Query.NEWSYNCFIGURE, {
'figClassName': figname.__name__,
"dataName": dataname,
'fig_class_came': figname.__name__,
'data_name': dataname,
'args': args,
'kwargs': kwargs})
status = self.send(query)
......
......@@ -226,38 +226,33 @@ class MplHandler(SocketServer.StreamRequestHandler):
elif request.query_type == request.LISTFIG:
reply = self.treat_list_data(request.content)
else:
self.servPrint('received unknown query type')
self.serv_print('received unknown query type')
reply = Status(False, "received unknown query type")
elif isinstance(request, Status):
if request.value:
pass # if it is just a positiv status message do nothing
else:
self.servPrint('the client Side reported of an error:')
self.servPrint('----' + request.content)
self.serv_print('the client Side reported of an error:')
self.serv_print('----' + request.content)
elif isinstance(request, Answer):
# needed for server???
pass
elif isinstance(request, request):
self.servPrint('received unknown requestnal')
self.serv_print('received unknown requestnal')
reply = Status(False, "received unknown requestnal")
else:
self.servPrint('what is happening here???'
self.serv_print('what is happening here???'
' received Object of type:')
self.servPrint(str(request))
self.serv_print(str(request))
reply = Status(False, "received something totally diffenent")
if isinstance(reply, Signal):
if debug:
self.servPrint("returning {}-Signal:".format(type(reply)))
self.serv_print("returning {}-Signal:".format(type(reply)))
except EOFError:
print("could not unpickle, noting in the file")
except Exception as e:
print("An unspecified error occured. ")
reply = Status(False, "An unspecified error occured."
+ e.message + e.args)
finally:
if reply:
pickle.dump(reply, self.wfile)
......@@ -275,7 +270,7 @@ class MplServer2(SocketServer.TCPServer):
def define_known_functions(self, functions):
'''Function to overwrite in order to declare the known
I/O functions by the server context.'''
self.knownFunctions = functions
self.known_functions = functions
# DEFINE KNOWN FIGURE CLASSES --------------------------------------
def define_known_figures(self, figures):
......
......@@ -4,33 +4,33 @@ verbose = 2
failed = []
states = {}
# Signal
suite_signal = unittest.TestLoader().loadTestsFromTestCase(SignalTestCase)
states.update({'Signal': unittest.TextTestRunner(verbosity=verbose).run(suite_signal).wasSuccessful()})
# Query
suite_query = unittest.TestLoader().loadTestsFromTestCase(QueryTestCase)
states.update({'Query': unittest.TextTestRunner(verbosity=verbose).run(suite_query).wasSuccessful()})
# Answer
suite_answer = unittest.TestLoader().loadTestsFromTestCase(AnswerTestCase)
states.update({'Answer': unittest.TextTestRunner(verbosity=verbose).run(suite_answer).wasSuccessful()})
# Status
suite_status = unittest.TestLoader().loadTestsFromTestCase(StatusTestCase)
states.update({'Status': unittest.TextTestRunner(verbosity=verbose).run(suite_status).wasSuccessful()})
# Server
suite_server = unittest.TestLoader().loadTestsFromTestCase(ServerTestCase)
states.update({'Server': unittest.TextTestRunner(verbosity=verbose).run(suite_server).wasSuccessful()})
# Client
suite_client = unittest.TestLoader().loadTestsFromTestCase(ClientTestCase)
states.update({'Client': unittest.TextTestRunner(verbosity=verbose).run(suite_client).wasSuccessful()})
# Connection Setup
suite_com = unittest.TestLoader().loadTestsFromTestCase(ComSetupTestCase)
states.update({'Communication': unittest.TextTestRunner(verbosity=verbose).run(suite_com).wasSuccessful()})
#~ # Signal
#~ suite_signal = unittest.TestLoader().loadTestsFromTestCase(SignalTestCase)
#~ states.update({'Signal': unittest.TextTestRunner(verbosity=verbose).run(suite_signal).wasSuccessful()})
#~
#~ # Query
#~ suite_query = unittest.TestLoader().loadTestsFromTestCase(QueryTestCase)
#~ states.update({'Query': unittest.TextTestRunner(verbosity=verbose).run(suite_query).wasSuccessful()})
#~
#~ # Answer
#~ suite_answer = unittest.TestLoader().loadTestsFromTestCase(AnswerTestCase)
#~ states.update({'Answer': unittest.TextTestRunner(verbosity=verbose).run(suite_answer).wasSuccessful()})
#~
#~ # Status
#~ suite_status = unittest.TestLoader().loadTestsFromTestCase(StatusTestCase)
#~ states.update({'Status': unittest.TextTestRunner(verbosity=verbose).run(suite_status).wasSuccessful()})
#~
#~ # Server
#~ suite_server = unittest.TestLoader().loadTestsFromTestCase(ServerTestCase)
#~ states.update({'Server': unittest.TextTestRunner(verbosity=verbose).run(suite_server).wasSuccessful()})
#~
#~ # Client
#~ suite_client = unittest.TestLoader().loadTestsFromTestCase(ClientTestCase)
#~ states.update({'Client': unittest.TextTestRunner(verbosity=verbose).run(suite_client).wasSuccessful()})
#~
#~ # Connection Setup
#~ suite_com = unittest.TestLoader().loadTestsFromTestCase(ComSetupTestCase)
#~ states.update({'Communication': unittest.TextTestRunner(verbosity=verbose).run(suite_com).wasSuccessful()})
# Remote fig creation
suite_figcreation = unittest.TestLoader().loadTestsFromTestCase(RemoteFigTestCase)
......
......@@ -60,32 +60,32 @@ class RemoteFigTestCase(unittest.TestCase):
self.datanames = ['data1','data2']
self.client.read_data('readStupidData', self.datanames[0])
self.client.read_data('readStupidData2', self.datanames[1])
def test_Readdata(self):
rm_data = self.client.list_remote_data()
self.assertEqual(rm_data,self.datanames)
#~ def test_Readdata(self):
#~ rm_data = self.client.list_remote_data()
#~ self.assertEqual(rm_data,self.datanames)
def test_NewSyncFig(self):
fig1 = self.client.new_sync_figure(FigTestc, ('data1',))
self.assertIsInstance(fig1,FigTestc)
def test_MultiFig(self):
fig2 = self.client.new_sync_figure(FigTestc2, ('data1','data2'), xRange_p1=[-2.0, 2.0], xRange_p2=[-3, 3], yRange=[-2.0, 2.0])
self.assertIsInstance(fig2,FigTestc2)
self.assertEqual(len(fig2.get_axes()),2)
# Testing the Alias functionality
self.assertEqual(fig2.get_axes_by_name('p1').keywords['xRange'],[-2.0, 2.0])
self.assertEqual(fig2.get_axes_by_name('p2').keywords['xRange'],[-3, 3])
self.assertEqual(fig2.get_axes_by_name('p1').keywords['yRange'],[-2.0, 2.0])
self.assertEqual(fig2.get_axes_by_name('p2').keywords['yRange'],[-2.0, 2.0])
def test_Update(self):
fig1 = self.client.newSyncFigure(FigTestc, ('data1',))
fig1.update(xRange=[-2, 2],yRange=[-2, 2])
self.assertEqual(fig1.get_axes_by_name('p1').keywords['xRange'],[-2, 2])
self.assertEqual(fig1.get_axes_by_name('p1').keywords['yRange'],[-2, 2])
#~
#~ def test_MultiFig(self):
#~ fig2 = self.client.new_sync_figure(FigTestc2, ('data1','data2'), xRange_p1=[-2.0, 2.0], xRange_p2=[-3, 3], yRange=[-2.0, 2.0])
#~
#~ self.assertIsInstance(fig2,FigTestc2)
#~ self.assertEqual(len(fig2.get_axes()),2)
#~
#~ # Testing the Alias functionality
#~ self.assertEqual(fig2.get_axes_by_name('p1').keywords['xRange'],[-2.0, 2.0])
#~ self.assertEqual(fig2.get_axes_by_name('p2').keywords['xRange'],[-3, 3])
#~ self.assertEqual(fig2.get_axes_by_name('p1').keywords['yRange'],[-2.0, 2.0])
#~ self.assertEqual(fig2.get_axes_by_name('p2').keywords['yRange'],[-2.0, 2.0])
#~
#~ def test_Update(self):
#~ fig1 = self.client.newSyncFigure(FigTestc, ('data1',))
#~ fig1.update(xRange=[-2, 2],yRange=[-2, 2])
#~ self.assertEqual(fig1.get_axes_by_name('p1').keywords['xRange'],[-2, 2])
#~ self.assertEqual(fig1.get_axes_by_name('p1').keywords['yRange'],[-2, 2])
#~ def test_ReSync(self):
#~ fig1 = self.client.newSyncFigure(FigTestc, ('data1',))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment