示例#1
0
    def test_prepare(self):
        class DummyModule:  # pylint: disable=too-few-public-methods
            def __init__(self):
                self.prep_called = False

            def prepare_data(self):
                self.prep_called = True

        dummy = DummyModule()
        assert not dummy.prep_called
        main.prepare_module_data([dummy])
        assert dummy.prep_called
    def test_prepare_module_data(self):
        # make sure there's some to start with
        search = path.get_full_path(antismash.__file__, '**', "*.h3?")
        existing_press_files = glob.glob(search, recursive=True)
        assert existing_press_files

        # then remove them all
        for pressed in existing_press_files:
            os.unlink(pressed)
        current_press_files = glob.glob(search, recursive=True)
        assert not current_press_files

        # and make sure they're all regenerated properly
        prepare_module_data()
        current_press_files = glob.glob(search, recursive=True)
        assert current_press_files == existing_press_files