Beispiel #1
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)
     envlist = ['hello', 'world']
     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
Beispiel #2
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.sdist()
    assert sdist_path == p
Beispiel #3
0
def test_sdist_latest(tmpdir, newconfig):
    distshare = tmpdir.join("distshare")
    config = newconfig([], """
            [tox]
            distshare=%s
            sdistsrc={distshare}/pkg123-*
    """ % distshare)
    distshare.ensure("pkg123-1.3.5.zip")
    p = distshare.ensure("pkg123-1.4.5.zip")
    distshare.ensure("pkg123-1.4.5a1.zip")
    session = Session(config)
    sdist_path = session.sdist()
    assert sdist_path == p
Beispiel #4
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"))
Beispiel #5
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.sdist()
     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)
Beispiel #6
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.sdist()
     assert sdist.check()
     assert sdist.ext == ".zip"
     assert sdist == config.distdir.join(sdist.basename)
     sdist2 = session.sdist()
     assert sdist2 == sdist
     sdist.write("hello")
     assert sdist.stat().size < 10
     sdist_new = Session(config).sdist()
     assert sdist_new == sdist
     assert sdist_new.stat().size > 10
Beispiel #7
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")
Beispiel #8
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"))
Beispiel #9
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.sdist()
     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)
Beispiel #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")
Beispiel #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
Beispiel #12
0
    def run_tests(self):
        print("running tests")
        sys.path.append(join(EXAMPLES_DIR, 'django'))
        os.environ['DJANGO_SETTINGS_MODULE'] = 'rpctest.settings'
        ret = 0
        ret = call_pytest(
            'interface',
            'model',
            'multipython',
            'protocol',
            'test_null_server.py',
            'test_service.py',
            'test_soft_validation.py',
            'test_util.py',
            'test_sqlalchemy.py',
            'test_sqlalchemy_deprecated.py',
            # here we run django tests in the same process
            # for coverage reason
            'interop/test_django.py',
            'interop/test_pyramid.py',
            capture=self.capture) or ret
        # test different versions of Django
        # FIXME: better to use tox in CI script
        # For now we run it here
        from tox._config import parseconfig
        from tox._cmdline import Session
        tox_args = ['-ctox.django.ini']
        config = parseconfig(tox_args, 'tox')
        ret = Session(config).runcommand() or ret

        ret = call_pytest_subprocess('interop/test_httprpc.py',
                                     capture=self.capture) or ret
        ret = call_pytest_subprocess('interop/test_soap_client_http.py',
                                     capture=self.capture) or ret
        ret = call_pytest_subprocess('interop/test_soap_client_zeromq.py',
                                     capture=self.capture) or ret
        ret = call_pytest_subprocess('interop/test_suds.py',
                                     capture=self.capture) or ret
        ret = call_trial('interop/test_soap_client_http_twisted.py',
                         'transport/test_msgpack.py',
                         capture=self.capture) or ret

        if ret == 0:
            print(GREEN + "All that glisters is not gold." + RESET)
        else:
            print(RED + "Something is rotten in the state of Denmark." + RESET)

        raise SystemExit(ret)
Beispiel #13
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.sdist()
     assert sdist.check()
     assert sdist.ext == ".zip"
     assert sdist == config.distdir.join(sdist.basename)
     sdist2 = session.sdist()
     assert sdist2 == sdist
     sdist.write("hello")
     assert sdist.stat().size < 10
     sdist_new = Session(config).sdist()
     assert sdist_new == sdist
     assert sdist_new.stat().size > 10
Beispiel #14
0
def test_installpkg(tmpdir, newconfig):
    p = tmpdir.ensure("pkg123-1.0.zip")
    config = newconfig(["--installpkg=%s" % p], "")
    session = Session(config)
    sdist_path = session.sdist()
    assert sdist_path == p
Beispiel #15
0
def test_installpkg(tmpdir, newconfig):
    p = tmpdir.ensure("pkg123-1.0.zip")
    config = newconfig(["--installpkg=%s" % p], "")
    session = Session(config)
    sdist_path = session.sdist()
    assert sdist_path == p