Exemplo n.º 1
0
 def test_lock_with_none_value(self):
     try:
         Globalize.lock(lock=None)
     except GlobalizeObjectError as e:
         assert "Cannot globalize target object because it is None object" in str(
             e
         ), "It should raise an exception about target object could not be a None object."
     else:
         assert False, "It should raise an exception if the value is None."
Exemplo n.º 2
0
    def test_lock_with_normal_value(self):
        from multiprocessing.synchronize import Lock as synchronize_Lock
        from multiprocessing import Lock

        Globalize.lock(lock=Lock())
        from multirunnable.api.manage import Running_Lock
        assert isinstance(
            Running_Lock, synchronize_Lock
        ) is True, "It should save instance to the target global variable *Running_Lock*."
Exemplo n.º 3
0
 def globalize_instance(self, obj) -> None:
     _Globalize.lock(lock=obj)