Пример #1
0
 def test_semaphore_with_none_value(self):
     try:
         Globalize.semaphore(smp=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."
Пример #2
0
    def test_semaphore_with_normal_value(self):
        from multiprocessing.synchronize import Semaphore as synchronize_Semaphore
        from multiprocessing import Semaphore

        Globalize.semaphore(smp=Semaphore())
        from multirunnable.api.manage import Running_Semaphore
        assert isinstance(
            Running_Semaphore, synchronize_Semaphore
        ) is True, "It should save instance to the target global variable *Running_Semaphore*."
Пример #3
0
 def globalize_instance(self, obj) -> None:
     _Globalize.semaphore(smp=obj)