Example #1
0
 def test_open_socket_parameter(self):
     self.assertFalse(os.path.exists("./my_socket_file"))
     msgq = MsgQ("./my_socket_file");
     msgq.setup()
     self.assertTrue(os.path.exists("./my_socket_file"))
     msgq.shutdown();
     self.assertFalse(os.path.exists("./my_socket_file"))
Example #2
0
 def test_open_socket_default(self):
     env_var = None
     orig_socket_file = None
     if "BUNDY_MSGQ_SOCKET_FILE" in os.environ:
         env_var = os.environ["BUNDY_MSGQ_SOCKET_FILE"]
         del os.environ["BUNDY_MSGQ_SOCKET_FILE"]
     # temporarily replace the class "default" not to be disrupted by
     # any running BUNDY instance.
     if "BUNDY_TEST_SOCKET_FILE" in os.environ:
         MsgQ.SOCKET_FILE = os.environ["BUNDY_TEST_SOCKET_FILE"]
     socket_file = MsgQ.SOCKET_FILE
     self.assertFalse(os.path.exists(socket_file))
     msgq = MsgQ();
     try:
         msgq.setup()
         self.assertTrue(os.path.exists(socket_file))
         msgq.shutdown()
         self.assertFalse(os.path.exists(socket_file))
     except socket.error:
         # ok, the install path doesn't exist at all,
         # so we can't check any further
         pass
     if env_var is not None:
         os.environ["BUNDY_MSGQ_SOCKET_FILE"] = env_var
     if orig_socket_file is not None:
         MsgQ.SOCKET_FILE = orig_socket_file
Example #3
0
 def test_open_socket_parameter(self):
     self.assertFalse(os.path.exists("./my_socket_file"))
     msgq = MsgQ("./my_socket_file")
     msgq.setup()
     self.assertTrue(os.path.exists("./my_socket_file"))
     msgq.shutdown()
     self.assertFalse(os.path.exists("./my_socket_file"))
Example #4
0
 def test_open_socket_default(self):
     env_var = None
     orig_socket_file = None
     if "BUNDY_MSGQ_SOCKET_FILE" in os.environ:
         env_var = os.environ["BUNDY_MSGQ_SOCKET_FILE"]
         del os.environ["BUNDY_MSGQ_SOCKET_FILE"]
     # temporarily replace the class "default" not to be disrupted by
     # any running BUNDY instance.
     if "BUNDY_TEST_SOCKET_FILE" in os.environ:
         MsgQ.SOCKET_FILE = os.environ["BUNDY_TEST_SOCKET_FILE"]
     socket_file = MsgQ.SOCKET_FILE
     self.assertFalse(os.path.exists(socket_file))
     msgq = MsgQ()
     try:
         msgq.setup()
         self.assertTrue(os.path.exists(socket_file))
         msgq.shutdown()
         self.assertFalse(os.path.exists(socket_file))
     except socket.error:
         # ok, the install path doesn't exist at all,
         # so we can't check any further
         pass
     if env_var is not None:
         os.environ["BUNDY_MSGQ_SOCKET_FILE"] = env_var
     if orig_socket_file is not None:
         MsgQ.SOCKET_FILE = orig_socket_file
Example #5
0
 def test_open_socket_environment_variable(self):
     self.assertFalse(os.path.exists("my_socket_file"))
     os.environ["BUNDY_MSGQ_SOCKET_FILE"] = "./my_socket_file"
     msgq = MsgQ();
     msgq.setup()
     self.assertTrue(os.path.exists("./my_socket_file"))
     msgq.shutdown();
     self.assertFalse(os.path.exists("./my_socket_file"))
Example #6
0
 def test_open_socket_environment_variable(self):
     self.assertFalse(os.path.exists("my_socket_file"))
     os.environ["BUNDY_MSGQ_SOCKET_FILE"] = "./my_socket_file"
     msgq = MsgQ()
     msgq.setup()
     self.assertTrue(os.path.exists("./my_socket_file"))
     msgq.shutdown()
     self.assertFalse(os.path.exists("./my_socket_file"))