Пример #1
0
def test_utils(osparc_simcore_root_dir, package_dir):

    assert is_osparc_repo_dir(osparc_simcore_root_dir)

    assert search_osparc_repo_dir(package_dir) == osparc_simcore_root_dir
    assert search_osparc_repo_dir(
        osparc_simcore_root_dir) == osparc_simcore_root_dir

    assert not search_osparc_repo_dir(osparc_simcore_root_dir.parent)
Пример #2
0
def test_utils(osparc_simcore_root_dir, package_dir):
    assert is_osparc_repo_dir(osparc_simcore_root_dir)

    assert search_osparc_repo_dir(
        osparc_simcore_root_dir) == osparc_simcore_root_dir

    # assert not search_osparc_repo_dir(package_dir), "package is installed, should not be in osparc-repo"
    # assert search_osparc_repo_dir(package_dir) == osparc_simcore_root_dir, "in develop mode"

    assert not search_osparc_repo_dir(osparc_simcore_root_dir.parent)
Пример #3
0
def create_environ(skip_system_environ=False):
    """
        Build environment of substitutable variables

    """
    # system's environment variables
    environ = {} if skip_system_environ else dict(os.environ)

    # project-related environment variables
    here = os.path.dirname(__file__)
    environ["THIS_PACKAGE_DIR"] = here

    rootdir = search_osparc_repo_dir(start=here)
    if rootdir is not None:
        environ["OSPARC_SIMCORE_REPO_ROOTDIR"] = str(rootdir)

    return environ
def create_environ(*, skip_host_environ: bool = False) -> Dict[str, str]:
    """ Build environment with substitutable variables


    :param skip_host_environ: excludes os.environ , defaults to False
    :param skip_host_environ: bool, optional
    :return: a dictionary of variables to replace in config file
    :rtype: Dict[str, str]
    """

    # system's environment variables
    environ = dict() if skip_host_environ else dict(os.environ)

    # project-related environment variables
    rootdir = search_osparc_repo_dir(here)
    if rootdir is not None:
        environ.update({
            'OSPARC_SIMCORE_REPO_ROOTDIR': str(rootdir),
        })

    return environ