Esempio n. 1
0
def libspec_manager(tmpdir):
    from robotframework_ls.impl.libspec_manager import LibspecManager

    libspec_manager = LibspecManager(
        user_libspec_dir=str(tmpdir.join("user_libspec")))
    yield libspec_manager
    libspec_manager.dispose()
Esempio n. 2
0
def libspec_manager(tmpdir):
    from robotframework_ls.impl import workspace_symbols as workspace_symbols_module

    workspace_symbols_module.WORKSPACE_SYMBOLS_TIMEOUT = 5

    from robotframework_ls.impl.libspec_manager import LibspecManager

    libspec_manager = LibspecManager(
        user_libspec_dir=str(tmpdir.join("user_libspec")))
    yield libspec_manager
    libspec_manager.dispose()
Esempio n. 3
0
def sync_builtins(tmpdir_factory, cases):
    """
    Pre-generate the builtins.
    """
    from robotframework_ls.impl.libspec_manager import LibspecManager
    import shutil

    user_home = str(tmpdir_factory.mktemp("ls_user_home"))
    os.environ["ROBOTFRAMEWORK_LS_USER_HOME"] = user_home
    internal_libspec_dir = LibspecManager.get_internal_builtins_libspec_dir()
    try:
        os.makedirs(internal_libspec_dir)
    except:
        # Ignore exception if it's already created.
        pass

    builtin_libs = cases.get_path("builtin_libs")

    # Uncomment the line to regenerate the libspec files for the builtin libraries.
    # LibspecManager(builtin_libspec_dir=builtin_libs)

    # Note: use private copy instead of re-creating because it's one of the
    # slowest things when starting test cases.
    # Locally it's the difference from the test suite taking 15 or 25 seconds
    # (with tests with 12 cpus in parallel).

    for name in os.listdir(builtin_libs):
        shutil.copyfile(
            os.path.join(builtin_libs, name), os.path.join(internal_libspec_dir, name)
        )
Esempio n. 4
0
    def __init__(self, read_from, write_to, libspec_manager=None):
        from robotframework_ls.impl.libspec_manager import LibspecManager

        if libspec_manager is None:
            libspec_manager = LibspecManager()

        self.libspec_manager = libspec_manager
        PythonLanguageServer.__init__(self, read_from, write_to, max_workers=1)
        self._version = None
Esempio n. 5
0
    def __init__(self, read_from, write_to, libspec_manager=None):
        from robotframework_ls.impl.libspec_manager import LibspecManager

        if libspec_manager is None:
            try:
                libspec_manager = LibspecManager()
            except:
                log.exception("Unable to properly initialize the LibspecManager.")
                raise

        self.libspec_manager = libspec_manager
        PythonLanguageServer.__init__(self, read_from, write_to)
        self._version = None
Esempio n. 6
0
    def __init__(
        self,
        read_from,
        write_to,
        libspec_manager=None,
        observer: Optional[IFSObserver] = None,
    ):
        from robotframework_ls.impl.libspec_manager import LibspecManager

        if libspec_manager is None:
            try:
                libspec_manager = LibspecManager(observer=observer)
            except:
                log.exception("Unable to properly initialize the LibspecManager.")
                raise

        self.libspec_manager = libspec_manager
        PythonLanguageServer.__init__(self, read_from, write_to)
        self._version = None
        self._next_time = partial(next, itertools.count(0))
def _generate_new_libspec(libspec_manager: LibspecManager,
                          cases: CasesFixture):
    filename = cases.get_path("case_argspec/case_argspec.py")
    libspec_manager._create_libspec(filename)