コード例 #1
0
ファイル: test_z_cmdline.py プロジェクト: Itxaka/tox-plus
def test_report_protocol(newconfig):
    config = newconfig(
        [],
        """
            [testenv:mypython]
            deps=xy
    """,
    )

    class Popen:
        def __init__(self, *args, **kwargs):
            pass

        def communicate(self):
            return "", ""

        def wait(self):
            pass

    session = Session(config, popen=Popen, Report=ReportExpectMock)
    report = session.report
    report.expect("using")
    venv = session.getvenv("mypython")
    venv.update()
    report.expect("logpopen")
コード例 #2
0
ファイル: test_z_cmdline.py プロジェクト: Itxaka/tox-plus
 def test_summary_status(self, initproj, capfd):
     initproj(
         "logexample123-0.5",
         filedefs={
             "tests": {"test_hello.py": "def test_hello(): pass"},
             "tox.ini": """
         [testenv:hello]
         [testenv:world]
         """,
         },
     )
     config = parseconfig([])
     session = Session(config)
     envs = session.venvlist
     assert len(envs) == 2
     env1, env2 = envs
     env1.status = "FAIL XYZ"
     assert env1.status
     env2.status = 0
     assert not env2.status
     session._summary()
     out, err = capfd.readouterr()
     exp = "%s: FAIL XYZ" % env1.envconfig.envname
     assert exp in out
     exp = "%s: commands succeeded" % env2.envconfig.envname
     assert exp in out
コード例 #3
0
def test_sdist_latest(tmpdir, newconfig):
    distshare = tmpdir.join("distshare")
    config = newconfig([], """
            [tox]
            distshare=%s
            sdistsrc={distshare}/pkg123-*
    """ % distshare)
    p = distshare.ensure("pkg123-1.4.5.zip")
    distshare.ensure("pkg123-1.4.5a1.zip")
    session = Session(config)
    sdist_path = session.get_installpkg_path()
    assert sdist_path == p
コード例 #4
0
ファイル: test_z_cmdline.py プロジェクト: Itxaka/tox-plus
def test_sdist_latest(tmpdir, newconfig):
    distshare = tmpdir.join("distshare")
    config = newconfig(
        [],
        """
            [tox]
            distshare=%s
            sdistsrc={distshare}/pkg123-*
    """
        % distshare,
    )
    p = distshare.ensure("pkg123-1.4.5.zip")
    distshare.ensure("pkg123-1.4.5a1.zip")
    session = Session(config)
    sdist_path = session.get_installpkg_path()
    assert sdist_path == p
コード例 #5
0
 def test_getvenv(self, initproj, capfd):
     initproj("logexample123-0.5", filedefs={
         'tests': {'test_hello.py': "def test_hello(): pass"},
         'tox.ini': '''
         [testenv:hello]
         [testenv:world]
         '''
     })
     config = parseconfig([])
     session = Session(config)
     venv1 = session.getvenv("hello")
     venv2 = session.getvenv("hello")
     assert venv1 is venv2
     venv1 = session.getvenv("world")
     venv2 = session.getvenv("world")
     assert venv1 is venv2
     pytest.raises(LookupError, lambda: session.getvenv("qwe"))
コード例 #6
0
 def test_make_sdist_distshare(self, tmpdir, initproj):
     distshare = tmpdir.join("distshare")
     initproj("example123-0.6", filedefs={
         'tests': {'test_hello.py': "def test_hello(): pass"},
         'tox.ini': '''
         [tox]
         distshare=%s
         ''' % distshare
     })
     config = parseconfig([])
     session = Session(config)
     sdist = session.get_installpkg_path()
     assert sdist.check()
     assert sdist.ext == ".zip"
     assert sdist == config.distdir.join(sdist.basename)
     sdist_share = config.distshare.join(sdist.basename)
     assert sdist_share.check()
     assert sdist_share.read("rb") == sdist.read("rb"), (sdist_share, sdist)
コード例 #7
0
ファイル: test_z_cmdline.py プロジェクト: Itxaka/tox-plus
 def test_getvenv(self, initproj, capfd):
     initproj(
         "logexample123-0.5",
         filedefs={
             "tests": {"test_hello.py": "def test_hello(): pass"},
             "tox.ini": """
         [testenv:hello]
         [testenv:world]
         """,
         },
     )
     config = parseconfig([])
     session = Session(config)
     venv1 = session.getvenv("hello")
     venv2 = session.getvenv("hello")
     assert venv1 is venv2
     venv1 = session.getvenv("world")
     venv2 = session.getvenv("world")
     assert venv1 is venv2
     pytest.raises(LookupError, lambda: session.getvenv("qwe"))
コード例 #8
0
ファイル: test_z_cmdline.py プロジェクト: Itxaka/tox-plus
 def test_make_sdist(self, initproj):
     initproj(
         "example123-0.5",
         filedefs={
             "tests": {"test_hello.py": "def test_hello(): pass"},
             "tox.ini": """
         """,
         },
     )
     config = parseconfig([])
     session = Session(config)
     sdist = session.get_installpkg_path()
     assert sdist.check()
     assert sdist.ext == ".zip"
     assert sdist == config.distdir.join(sdist.basename)
     sdist2 = session.get_installpkg_path()
     assert sdist2 == sdist
     sdist.write("hello")
     assert sdist.stat().size < 10
     sdist_new = Session(config).get_installpkg_path()
     assert sdist_new == sdist
     assert sdist_new.stat().size > 10
コード例 #9
0
ファイル: test_z_cmdline.py プロジェクト: Itxaka/tox-plus
 def test_make_sdist_distshare(self, tmpdir, initproj):
     distshare = tmpdir.join("distshare")
     initproj(
         "example123-0.6",
         filedefs={
             "tests": {"test_hello.py": "def test_hello(): pass"},
             "tox.ini": """
         [tox]
         distshare=%s
         """
             % distshare,
         },
     )
     config = parseconfig([])
     session = Session(config)
     sdist = session.get_installpkg_path()
     assert sdist.check()
     assert sdist.ext == ".zip"
     assert sdist == config.distdir.join(sdist.basename)
     sdist_share = config.distshare.join(sdist.basename)
     assert sdist_share.check()
     assert sdist_share.read("rb") == sdist.read("rb"), (sdist_share, sdist)
コード例 #10
0
def test_report_protocol(newconfig):
    config = newconfig([], """
            [testenv:mypython]
            deps=xy
    """)

    class Popen:
        def __init__(self, *args, **kwargs):
            pass

        def communicate(self):
            return "", ""

        def wait(self):
            pass

    session = Session(config, popen=Popen,
                      Report=ReportExpectMock)
    report = session.report
    report.expect("using")
    venv = session.getvenv("mypython")
    venv.update()
    report.expect("logpopen")
コード例 #11
0
 def test_summary_status(self, initproj, capfd):
     initproj("logexample123-0.5", filedefs={
         'tests': {'test_hello.py': "def test_hello(): pass"},
         'tox.ini': '''
         [testenv:hello]
         [testenv:world]
         '''
     })
     config = parseconfig([])
     session = Session(config)
     envs = session.venvlist
     assert len(envs) == 2
     env1, env2 = envs
     env1.status = "FAIL XYZ"
     assert env1.status
     env2.status = 0
     assert not env2.status
     session._summary()
     out, err = capfd.readouterr()
     exp = "%s: FAIL XYZ" % env1.envconfig.envname
     assert exp in out
     exp = "%s: commands succeeded" % env2.envconfig.envname
     assert exp in out
コード例 #12
0
 def test_make_sdist(self, initproj):
     initproj("example123-0.5", filedefs={
         'tests': {'test_hello.py': "def test_hello(): pass"},
         'tox.ini': '''
         '''
     })
     config = parseconfig([])
     session = Session(config)
     sdist = session.get_installpkg_path()
     assert sdist.check()
     assert sdist.ext == ".zip"
     assert sdist == config.distdir.join(sdist.basename)
     sdist2 = session.get_installpkg_path()
     assert sdist2 == sdist
     sdist.write("hello")
     assert sdist.stat().size < 10
     sdist_new = Session(config).get_installpkg_path()
     assert sdist_new == sdist
     assert sdist_new.stat().size > 10
コード例 #13
0
def test_installpkg(tmpdir, newconfig):
    p = tmpdir.ensure("pkg123-1.0.zip")
    config = newconfig(["--installpkg=%s" % p], "")
    session = Session(config)
    sdist_path = session.get_installpkg_path()
    assert sdist_path == p
コード例 #14
0
ファイル: test_z_cmdline.py プロジェクト: Itxaka/tox-plus
def test_installpkg(tmpdir, newconfig):
    p = tmpdir.ensure("pkg123-1.0.zip")
    config = newconfig(["--installpkg=%s" % p], "")
    session = Session(config)
    sdist_path = session.get_installpkg_path()
    assert sdist_path == p