Example #1
0
    def __call__(self, *args):
        test_result = True

        try:
            os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY, PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted")

            warnings.filterwarnings("ignore", category=ResourceWarning)
            ccore_library.initialize()

            self.call_object(args)

        except os.error:
            warnings.warn("Test skipped: no rights to rename C/C++ pyclustering library for testing.")
            return

        except:
            test_result = False

        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted", PATH_PYCLUSTERING_CCORE_LIBRARY)
        ccore_library.initialize()

        warnings.filterwarnings("default", category=ResourceWarning)

        if test_result is False:
            raise AssertionError("Test failed")
Example #2
0
    def __call__(self, *args):
        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY,
                  PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted")
        ccore_library.initialize()

        self.call_object(args)

        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted",
                  PATH_PYCLUSTERING_CCORE_LIBRARY)
        ccore_library.initialize()
Example #3
0
    def __call__(self, *args):
        print("[TEST] Ignore next print related to problems with pyclustering ccore");

        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY, PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted");
        ccore_library.initialize();

        self.call_object(args);

        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted", PATH_PYCLUSTERING_CCORE_LIBRARY);
        ccore_library.initialize();
Example #4
0
    def __call__(self, *args):
        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY, PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted")
        self.__create_corrupted_library(PATH_PYCLUSTERING_CCORE_LIBRARY)
        
        ccore_library.initialize()

        self.call_object(args)

        self.__remove_corrupted_library(PATH_PYCLUSTERING_CCORE_LIBRARY)
        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted", PATH_PYCLUSTERING_CCORE_LIBRARY)
        ccore_library.initialize()
Example #5
0
    def __call__(self, *args):
        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY, PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted");
        self.__create_corrupted_library(PATH_PYCLUSTERING_CCORE_LIBRARY);
        
        ccore_library.initialize();

        self.call_object(args);

        self.__remove_corrupted_library(PATH_PYCLUSTERING_CCORE_LIBRARY);
        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted", PATH_PYCLUSTERING_CCORE_LIBRARY);
        ccore_library.initialize();
Example #6
0
    def __call__(self, *args):
        print("[TEST] Ignore next print related to problems with pyclustering ccore")
        test_result = True

        try:
            os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY, PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted")
            ccore_library.initialize()

            self.call_object(args)

        except:
            test_result = False

        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted", PATH_PYCLUSTERING_CCORE_LIBRARY)
        ccore_library.initialize()

        if test_result is False:
            raise AssertionError("Test failed")
Example #7
0
    def __call__(self, *args):
        print("[TEST] Ignore next print related to problems with pyclustering ccore")
        test_result = True

        try:
            os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY, PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted")
            ccore_library.initialize()

            self.call_object(args)

        except:
            test_result = False

        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted", PATH_PYCLUSTERING_CCORE_LIBRARY)
        ccore_library.initialize()

        if test_result is False:
            raise AssertionError("Test failed")
Example #8
0
    def __call__(self, *args):
        try:
            os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY, PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted")
        except os.error:
            warnings.warn("Test skipped: no rights to rename C/C++ pyclustering library for testing.")
            return

        self.__create_corrupted_library(PATH_PYCLUSTERING_CCORE_LIBRARY)

        warnings.filterwarnings("ignore", category=ResourceWarning)
        ccore_library.initialize()
        self.call_object(args)

        self.__remove_corrupted_library(PATH_PYCLUSTERING_CCORE_LIBRARY)
        os.rename(PATH_PYCLUSTERING_CCORE_LIBRARY + "_corrupted", PATH_PYCLUSTERING_CCORE_LIBRARY)
        ccore_library.initialize()

        warnings.filterwarnings("default", category=ResourceWarning)