Exemple #1
0
def run_tests(module_path, pyver, source_folder, tmp_folder,
              exluded_tags, num_cores=3, verbosity=None):

    verbosity = verbosity or (2 if platform.system() == "Windows" else 1)
    exluded_tags = exluded_tags or ""
    venv_dest = os.path.join(tmp_folder, "venv")
    if not os.path.exists(venv_dest):
        os.makedirs(venv_dest)
    venv_exe = os.path.join(venv_dest,
                            "bin" if platform.system() != "Windows" else "Scripts",
                            "activate")
    if exluded_tags:
        exluded_tags = '-A "%s"' % " and ".join(["not %s" % tag for tag in exluded_tags])

    pyenv = pylocations[pyver]
    source_cmd = "." if platform.system() != "Windows" else ""
    # Prevent OSX to lock when no output is received
    debug_traces = ""  # "--debug=nose,nose.result" if platform.system() == "Darwin" and pyver != "py27" else ""
    # pyenv = "/usr/local/bin/python2"
    multiprocess = ("--processes=%s --process-timeout=1000 "
                    "--process-restartworker --with-coverage" % num_cores) if platform.system() != "Darwin" or pyver == "py27" else ""

    if num_cores <= 1:
        multiprocess = ""

    pip_installs = "pip install -r conans/requirements.txt && " \
                   "pip install -r conans/requirements_dev.txt && " \
                   "pip install -r conans/requirements_server.txt && "

    if platform.system() == "Darwin":
        pip_installs += "pip install -r conans/requirements_osx.txt && "

    #  --nocapture
    command = "virtualenv --python \"{pyenv}\" \"{venv_dest}\" && " \
              "{source_cmd} \"{venv_exe}\" && " \
              "{pip_installs} " \
              "python setup.py install && " \
              "conan --version && conan --help && " \
              "nosetests {module_path} {excluded_tags} --verbosity={verbosity} " \
              "{multiprocess} " \
              "{debug_traces} " \
              "--with-xunit " \
              "&& codecov -t f1a9c517-3d81-4213-9f51-61513111fc28".format(
                                    **{"module_path": module_path,
                                       "pyenv": pyenv,
                                       "excluded_tags": exluded_tags,
                                       "venv_dest": venv_dest,
                                       "verbosity": verbosity,
                                       "venv_exe": venv_exe,
                                       "source_cmd": source_cmd,
                                       "debug_traces": debug_traces,
                                       "multiprocess": multiprocess,
                                       "pip_installs": pip_installs})

    env = get_environ(tmp_folder)
    env["PYTHONPATH"] = source_folder
    env["CONAN_LOGGING_LEVEL"] = "50" if platform.system() == "Darwin" else "50"
    with chdir(source_folder):
        with environment_append(env):
            run(command)
Exemple #2
0
def run_tests(module_path, conan_branch, pyver, tmp_folder, num_cores=3):

    venv_dest = os.path.join(tmp_folder, "venv")
    if not os.path.exists(venv_dest):
        os.makedirs(venv_dest)
    venv_exe = os.path.join(venv_dest,
                            "bin" if platform.system() != "Windows" else "Scripts",
                            "activate")

    pyenv = pylocations[pyver]
    source_cmd = "." if platform.system() != "Windows" else ""
    multiprocess = ""
    if (platform.system() != "Darwin" or pyver == "py27") and num_cores > 1:
        multiprocess = ("--processes=%s --process-timeout=1000 "
                        "--process-restartworker" % num_cores)

    pip_installs = ["pip install -r conan_tests/requirements.txt"]
    if platform.system() == "Windows":
        pip_installs.append("python.exe -m pip install --upgrade pip")
        if pyver != "py34":
            # Otherwise it fails the python setup.py install downloading stuff
            pip_installs.append('pip install requests["security"]')
        if pyver == "py36" and conan_branch != "0.30.3":
            pip_installs.append("pip install scons")

    else:
        pip_installs.append("pip install --upgrade pip")

    #  --nocapture
    command = "virtualenv --python \"{pyenv}\" \"{venv_dest}\" && " \
              "{source_cmd} \"{venv_exe}\" && " \
              "{pip_installs} && " \
              "cd {tmp_folder} && git clone --depth 1 " \
              "https://github.com/conan-io/conan.git -b {branch} conan_p && " \
              "cd conan_p && python setup.py install && cd {cwd} && " \
              "conan --version && conan --help && " \
              "nosetests {module_path} --verbosity=2 " \
              "{multiprocess} ".format(
                                    **{"module_path": module_path,
                                       "pyenv": pyenv,
                                       "branch": conan_branch,
                                       "venv_dest": venv_dest,
                                       "tmp_folder": tmp_folder,
                                       "venv_exe": venv_exe,
                                       "source_cmd": source_cmd,
                                       "multiprocess": multiprocess,
                                       "pip_installs": " && ".join(pip_installs),
                                       "cwd": os.getcwd()})

    env = get_environ(tmp_folder)
    env["CONAN_LOGGING_LEVEL"] = "50" if platform.system() == "Darwin" else "50"
    env['PYTHON_EGG_CACHE'] = os.path.join(tmp_folder, "egg")
    env['PYTHONPATH'] = os.path.join(tmp_folder, "conan_p")
    os.mkdir(env['PYTHON_EGG_CACHE'])
    with environment_append(env):
        print(command)
        run(command)
Exemple #3
0
def run_tests(module_path, pyver, source_folder, tmp_folder, flavor, excluded_tags,
              num_cores=3, verbosity=None):

    verbosity = verbosity or (2 if platform.system() == "Windows" else 1)
    venv_dest = os.path.join(tmp_folder, "venv")
    if not os.path.exists(venv_dest):
        os.makedirs(venv_dest)
    venv_exe = os.path.join(venv_dest,
                            "bin" if platform.system() != "Windows" else "Scripts",
                            "activate")

    exluded_tags_str = '-A "%s"' % " and ".join(["not %s" % tag for tag in excluded_tags]) if excluded_tags else ""

    pyenv = pylocations[pyver]
    source_cmd = "." if platform.system() != "Windows" else ""
    # Prevent OSX to lock when no output is received
    debug_traces = ""  # "--debug=nose,nose.result" if platform.system() == "Darwin" and pyver != "py27" else ""
    # pyenv = "/usr/local/bin/python2"
    multiprocess = ("--processes=%s --process-timeout=1000 "
                    "--process-restartworker --with-coverage" % num_cores) if platform.system() != "Darwin" else ""

    if num_cores <= 1:
        multiprocess = ""

    pip_installs = "pip install -r conans/requirements.txt && " \
                   "pip install -r conans/requirements_dev.txt && " \
                   "pip install -r conans/requirements_server.txt && "

    if platform.system() == "Darwin":
        pip_installs += "pip install -r conans/requirements_osx.txt && "

    #  --nocapture
    command = "virtualenv --python \"{pyenv}\" \"{venv_dest}\" && " \
              "{source_cmd} \"{venv_exe}\" && " \
              "{pip_installs} " \
              "python setup.py install && " \
              "conan --version && conan --help && " \
              "nosetests {module_path} {excluded_tags} --verbosity={verbosity} " \
              "{multiprocess} " \
              "{debug_traces} " \
              "--with-xunit " \
              "&& codecov -t f1a9c517-3d81-4213-9f51-61513111fc28".format(
                                    **{"module_path": module_path,
                                       "pyenv": pyenv,
                                       "excluded_tags": exluded_tags_str,
                                       "venv_dest": venv_dest,
                                       "verbosity": verbosity,
                                       "venv_exe": venv_exe,
                                       "source_cmd": source_cmd,
                                       "debug_traces": debug_traces,
                                       "multiprocess": multiprocess,
                                       "pip_installs": pip_installs})

    env = get_environ(tmp_folder)
    env["PYTHONPATH"] = source_folder
    env["CONAN_LOGGING_LEVEL"] = "50" if platform.system() == "Darwin" else "50"
    env["CHANGE_AUTHOR_DISPLAY_NAME"] = ""
    env["TESTING_REVISIONS_ENABLED"] = "True" if flavor == "enabled_revisions" else "False"
    # Related with the error: LINK : fatal error LNK1318: Unexpected PDB error; RPC (23) '(0x000006BA)'
    # More info: http://blog.peter-b.co.uk/2017/02/stop-mspdbsrv-from-breaking-ci-build.html
    # Update, this doesn't solve the issue, other issues arise:
    # LINK : fatal error LNK1101: incorrect MSPDB140.DLL version; recheck installation of this product
    #env["_MSPDBSRV_ENDPOINT_"] = str(uuid.uuid4())
    # Try to specify a known folder to keep there msbuild failure logs
    env["MSBUILDDEBUGPATH"] = win_msbuilds_logs_folder

    with chdir(source_folder):
        with environment_append(env):
            run(command)
Exemple #4
0
def run_tests(module_path, pyver, source_folder, tmp_folder,
              exluded_tags, num_cores=3, verbosity=None):

    verbosity = verbosity or (2 if platform.system() == "Windows" else 1)
    exluded_tags = exluded_tags or ""
    venv_dest = os.path.join(tmp_folder, "venv")
    if not os.path.exists(venv_dest):
        os.makedirs(venv_dest)
    venv_exe = os.path.join(venv_dest,
                            "bin" if platform.system() != "Windows" else "Scripts",
                            "activate")
    if exluded_tags:
        exluded_tags = '-A "%s"' % " and ".join(["not %s" % tag for tag in exluded_tags])

    pyenv = pylocations[pyver]
    source_cmd = "." if platform.system() != "Windows" else ""
    # Prevent OSX to lock when no output is received
    debug_traces = ""  # "--debug=nose,nose.result" if platform.system() == "Darwin" and pyver != "py27" else ""
    # pyenv = "/usr/local/bin/python2"
    multiprocess = ("--processes=%s --process-timeout=1000 "
                    "--process-restartworker --with-coverage" % num_cores) if platform.system() != "Darwin" or pyver == "py27" else ""

    if num_cores <= 1:
        multiprocess = ""

    pip_installs = "pip install -r conans/requirements.txt && " \
                   "pip install -r conans/requirements_dev.txt && " \
                   "pip install -r conans/requirements_server.txt && "

    if platform.system() == "Darwin":
        pip_installs += "pip install -r conans/requirements_osx.txt && "

    #  --nocapture
    command = "virtualenv --python \"{pyenv}\" \"{venv_dest}\" && " \
              "{source_cmd} \"{venv_exe}\" && " \
              "{pip_installs} " \
              "python setup.py install && " \
              "conan --version && conan --help && " \
              "nosetests {module_path} {excluded_tags} --verbosity={verbosity} " \
              "{multiprocess} " \
              "{debug_traces} " \
              "--with-xunit " \
              "&& codecov -t f1a9c517-3d81-4213-9f51-61513111fc28".format(
                                    **{"module_path": module_path,
                                       "pyenv": pyenv,
                                       "excluded_tags": exluded_tags,
                                       "venv_dest": venv_dest,
                                       "verbosity": verbosity,
                                       "venv_exe": venv_exe,
                                       "source_cmd": source_cmd,
                                       "debug_traces": debug_traces,
                                       "multiprocess": multiprocess,
                                       "pip_installs": pip_installs})

    env = get_environ(tmp_folder)
    env["PYTHONPATH"] = source_folder
    env["CONAN_RECIPE_LINTER"] = "False"
    env["CONAN_LOGGING_LEVEL"] = "50" if platform.system() == "Darwin" else "50"
    env["CHANGE_AUTHOR_DISPLAY_NAME"] = ""
    with chdir(source_folder):
        with environment_append(env):
            run(command)
Exemple #5
0
def run_tests(module_path,
              pyver,
              source_folder,
              tmp_folder,
              flavor,
              excluded_tags,
              include_tags,
              num_cores=4,
              verbosity=None):

    verbosity = verbosity or (2 if platform.system() == "Windows" else 1)
    venv_dest = os.path.join(tmp_folder, "venv")
    if not os.path.exists(venv_dest):
        os.makedirs(venv_dest)
    venv_exe = os.path.join(
        venv_dest, "bin" if platform.system() != "Windows" else "Scripts",
        "activate")

    tags_str = []
    if excluded_tags or include_tags:
        if excluded_tags:
            for tag in excluded_tags:
                tags_str.append("not {}".format(tag))
            tags_str = '-m "%s"' % " and ".join(tags_str)
        if include_tags:
            for tag in include_tags:
                tags_str.append("{}".format(tag))
            tags_str = '-m "%s"' % " or ".join(tags_str)
    else:
        tags_str = ""

    pyenv = pylocations[pyver]
    source_cmd = "." if platform.system() != "Windows" else ""

    multiprocess = "-n=%s" % num_cores if num_cores > 1 else ""

    pip_installs = "pip install -r conans/requirements.txt && " \
                   "pip install -r conans/requirements_dev.txt && " \
                   "pip install -r conans/requirements_server.txt && "

    if platform.system() == "Darwin" and os.path.exists(
            "conans/requirements_osx.txt"):
        pip_installs += "pip install -r conans/requirements_osx.txt && "

    # FIXME: installing meson here. Linux images install their own tools,
    #  this is something we probably want to fix in the future
    if not pyver.startswith("py2") and platform.system() != "Linux":
        pip_installs += "pip install meson && "

    #  --nocapture
    command = "virtualenv --python \"{pyenv}\" \"{venv_dest}\" && " \
              "{source_cmd} \"{venv_exe}\" && " \
              "{pip_installs} " \
              "python setup.py install && " \
              "conan --version && conan --help && " \
              "pytest -rf {module_path} {tags_str} " \
              "{multiprocess} --durations=20".format(**{"module_path": module_path,
                                                        "pyenv": pyenv,
                                                        "tags_str": tags_str,
                                                        "venv_dest": venv_dest,
                                                        "verbosity": verbosity,
                                                        "venv_exe": venv_exe,
                                                        "source_cmd": source_cmd,
                                                        "multiprocess": multiprocess,
                                                        "pip_installs": pip_installs})

    env = get_environ(tmp_folder)
    env["PYTHONPATH"] = source_folder
    env["CONAN_LOGGING_LEVEL"] = "50" if platform.system(
    ) == "Darwin" else "50"
    env["CHANGE_AUTHOR_DISPLAY_NAME"] = ""
    if flavor == "enabled_revisions":
        env["TESTING_REVISIONS_ENABLED"] = "True"
    # Related with the error: LINK : fatal error LNK1318: Unexpected PDB error; RPC (23) '(0x000006BA)'
    # More info: http://blog.peter-b.co.uk/2017/02/stop-mspdbsrv-from-breaking-ci-build.html
    # Update, this doesn't solve the issue, other issues arise:
    # LINK : fatal error LNK1101: incorrect MSPDB140.DLL version; recheck installation of this product
    #env["_MSPDBSRV_ENDPOINT_"] = str(uuid.uuid4())
    # Try to specify a known folder to keep there msbuild failure logs
    env["MSBUILDDEBUGPATH"] = win_msbuilds_logs_folder

    with chdir(source_folder):
        with environment_append(env):
            run(command)
Exemple #6
0
def run_tests(module_path, conan_branch, pyver, tmp_folder, num_cores=3):

    venv_dest = os.path.join(tmp_folder, "venv")
    if not os.path.exists(venv_dest):
        os.makedirs(venv_dest)
    venv_exe = os.path.join(venv_dest,
                            "bin" if platform.system() != "Windows" else "Scripts",
                            "activate")

    pyenv = pylocations[pyver]
    source_cmd = "." if platform.system() != "Windows" else ""
    multiprocess = ""
    if (platform.system() != "Darwin" or pyver == "py27") and num_cores > 1:
        multiprocess = ("--processes=%s --process-timeout=1000 "
                        "--process-restartworker" % num_cores)

    pip_installs = ["pip install -r conan_tests/requirements.txt"]
    if platform.system() == "Windows":
        pip_installs.append("python.exe -m pip install --upgrade pip")
        pip_installs.append("pip install setuptools!=41.5.0") # FIXME: https://github.com/pypa/setuptools/issues/1891
        pip_installs.append('pip install requests["security"]')
        pip_installs.append("pip install scons")
        pip_installs.append("pip install pytest")
        pip_installs.append("pip install nose")
        if pyver != "py27":
            pip_installs.append("pip install meson")
    else:
        pip_installs.append("pip install --upgrade pip")

    change_dir = "/d " if platform.system() == "Windows" else ""
    #  --nocapture
    command = "virtualenv --python \"{pyenv}\" \"{venv_dest}\" && " \
              "{source_cmd} \"{venv_exe}\" && " \
              "{pip_installs} && " \
              "cd {change_dir}{tmp_folder} && git clone --depth 1 " \
              "https://github.com/conan-io/conan.git -b {branch} conan_p && " \
              "cd conan_p && pip install . && cd {change_dir}{cwd} && " \
              "conan --version && conan --help && " \
              "nosetests {module_path} --verbosity=2 " \
              "{multiprocess} ".format(
                                    **{"module_path": module_path,
                                       "pyenv": pyenv,
                                       "branch": conan_branch,
                                       "venv_dest": venv_dest,
                                       "tmp_folder": tmp_folder,
                                       "venv_exe": venv_exe,
                                       "source_cmd": source_cmd,
                                       "multiprocess": multiprocess,
                                       "pip_installs": " && ".join(pip_installs),
                                       "cwd": os.getcwd(),
                                       "change_dir": change_dir})

    env = get_environ(tmp_folder)
    env["CONAN_LOGGING_LEVEL"] = "50" if platform.system() == "Darwin" else "50"
    env['PYTHON_EGG_CACHE'] = os.path.join(tmp_folder, "egg")
    env['PYTHONPATH'] = os.path.join(tmp_folder, "conan_p")
    if pyver.startswith("py2"):
        env["USE_UNSUPPORTED_CONAN_WITH_PYTHON_2"] = "True"

    os.mkdir(env['PYTHON_EGG_CACHE'])
    with environment_append(env):
        print(command)
        run(command)