コード例 #1
0
ファイル: manage.py プロジェクト: Chisanan232/pyocean
    def test_bounded_semaphore_with_normal_value(self):
        from multiprocessing.synchronize import Semaphore as synchronize_Semaphore
        from multiprocessing import BoundedSemaphore

        Globalize.bounded_semaphore(bsmp=BoundedSemaphore())
        from multirunnable.api.manage import Running_Bounded_Semaphore
        assert isinstance(
            Running_Bounded_Semaphore, synchronize_Semaphore
        ) is True, "It should save instance to the target global variable *Running_Bounded_Semaphore*."
コード例 #2
0
ファイル: manage.py プロジェクト: Chisanan232/pyocean
 def test_bounded_semaphore_with_none_value(self):
     try:
         Globalize.bounded_semaphore(bsmp=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."
コード例 #3
0
 def globalize_instance(self, obj) -> None:
     _Globalize.bounded_semaphore(bsmp=obj)