Skip to content
Snippets Groups Projects
Commit e25c8a27 authored by Arno Schoenmakers's avatar Arno Schoenmakers
Browse files

Task #8571: Added python 2.6 compatibility for nested with-statement

parent be27ed52
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,8 @@ that the functions are OK. Next the same tests are done with the RPC and ...@@ -6,6 +6,8 @@ that the functions are OK. Next the same tests are done with the RPC and
Service classes in between. This should give the same results. Service classes in between. This should give the same results.
""" """
import sys import sys
from contextlib import nested
from lofar.messaging import Service, RPC from lofar.messaging import Service, RPC
class UserException(Exception): class UserException(Exception):
...@@ -117,7 +119,7 @@ if __name__ == '__main__': ...@@ -117,7 +119,7 @@ if __name__ == '__main__':
serv5 = Service(busname, "DictService", DictFunc, numthreads=1) serv5 = Service(busname, "DictService", DictFunc, numthreads=1)
# 'with' sets up the connection context and defines the scope of the service. # 'with' sets up the connection context and defines the scope of the service.
with serv1, serv2, serv3, serv4, serv5: with nested(serv1, serv2, serv3, serv4, serv5):
# Start listening in the background. This will start as many threads as defined by the instance # Start listening in the background. This will start as many threads as defined by the instance
serv1.StartListening() serv1.StartListening()
serv2.StartListening() serv2.StartListening()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment