示例#1
0
def test_get_commandlog(pkg):
    replog = ResultLog()
    envlog = replog.get_envlog("py36")
    assert "setup" not in envlog.dict
    setuplog = envlog.get_commandlog("setup")
    envlog.set_header(installpkg=pkg)
    setuplog.add_command(["virtualenv", "..."], "venv created", 0)
    expected = [{"command": ["virtualenv", "..."], "output": "venv created", "retcode": 0}]
    assert setuplog.list == expected
    assert envlog.dict["setup"]
    setuplog2 = replog.get_envlog("py36").get_commandlog("setup")
    assert setuplog2.list == setuplog.list
示例#2
0
def test_addenv_setpython(pkg):
    replog = ResultLog()
    envlog = replog.get_envlog("py36")
    envlog.set_python_info(py.path.local(sys.executable))
    envlog.set_header(installpkg=pkg)
    assert envlog.dict["python"]["version_info"] == list(sys.version_info)
    assert envlog.dict["python"]["version"] == sys.version
    assert envlog.dict["python"]["executable"] == sys.executable
示例#3
0
def test_set_header(pkg):
    replog = ResultLog()
    d = replog.dict
    assert replog.dict == d
    assert replog.dict["reportversion"] == "1"
    assert replog.dict["toxversion"] == tox.__version__
    assert replog.dict["platform"] == sys.platform
    assert replog.dict["host"] == socket.getfqdn()
    expected = {"basename": "hello-1.0.tar.gz", "sha256": pkg.computehash("sha256")}
    env_log = replog.get_envlog("a")
    env_log.set_header(installpkg=pkg)
    assert env_log.dict["installpkg"] == expected

    data = replog.dumps_json()
    replog2 = ResultLog.from_json(data)
    assert replog2.dict == replog.dict