Ejemplo n.º 1
0
def test_test_egg(pytestconfig):
    """ Creates template, runs setup.py test_egg
    """
    with PkgTemplate(name='acme.foo-1.0.0.dev1') as pkg:
        pkg.run('python %s/bin/easy_install %s' %
                (pkg.virtualenv, pkg.trunk_dir))

        pkg.install_package('pytest-cov')
        print(pkg.run_with_coverage(['%s/setup.py' % pkg.trunk_dir, 'test_egg'],
                                    pytestconfig, cd=HERE))
        py_env = PythonInstallation(pkg.python)
        egg = 'test.acme.foo-1.0.0.dev1-%s.egg' % py_env.py_version()
        egg = os.path.join(pkg.trunk_dir, 'dist', egg)
        assert os.path.isfile(egg)

        # Now install it and run the tests
        pkg.run('python %s/bin/easy_install %s' % (pkg.virtualenv, egg))

        # XXX stripping coverage/pylint off for now, fix this later - it should
        # work
        new_env = copy.copy(pkg.env)
        if 'BUILD_TAG' in new_env:
            del(new_env['BUILD_TAG'])

        pkg.run_with_coverage(['%s/bin/runtests' % (pkg.virtualenv), 'acme.foo'],
                              pytestconfig, cd=HERE, env=new_env)
def test_test_egg(pytestconfig):
    """ Creates template, runs setup.py test_egg
    """
    with PkgTemplate(name='acme.foo-1.0.0.dev1') as pkg:
        pkg.run('python %s/bin/easy_install %s' %
                (pkg.virtualenv, pkg.trunk_dir))

        pkg.install_package('pytest-cov')
        print(
            pkg.run_with_coverage(['%s/setup.py' % pkg.trunk_dir, 'test_egg'],
                                  pytestconfig,
                                  cd=HERE))
        py_env = PythonInstallation(pkg.python)
        egg = 'test.acme.foo-1.0.0.dev1-%s.egg' % py_env.py_version()
        egg = os.path.join(pkg.trunk_dir, 'dist', egg)
        assert os.path.isfile(egg)

        # Now install it and run the tests
        pkg.run('python %s/bin/easy_install %s' % (pkg.virtualenv, egg))

        # XXX stripping coverage/pylint off for now, fix this later - it should
        # work
        new_env = copy.copy(pkg.env)
        if 'BUILD_TAG' in new_env:
            del (new_env['BUILD_TAG'])

        pkg.run_with_coverage(
            ['%s/bin/runtests' % (pkg.virtualenv), 'acme.foo'],
            pytestconfig,
            cd=HERE,
            env=new_env)
Ejemplo n.º 3
0
def test_egg_revisions(pypi_chishop, svn_repo, workspace, pytestconfig):  # @UnusedVariable # NOQA
    # pypi_chishop.restore()
    package1_metadata = dict(version='1.2.3',)
    package2_metadata = dict(version='4.5.6',
                             install_requires='acme.er.package1==1.2.3')
    package3_metadata = dict(version='7.8.9',
                             install_requires='acme.er.package2==4.5.6')

    with ExitStack() as stack:
        pkg1 = stack.enter_context(create_pkg(pypi_chishop, svn_repo,
                                              'acme.er.package1',
                                              metadata=package1_metadata,
                                              dev=False))
        pkg2 = stack.enter_context(create_pkg(pypi_chishop, svn_repo,
                                              'acme.er.package2',
                                              metadata=package2_metadata,
                                              dev=False))
        pkg3 = stack.enter_context(PkgTemplate(name='acme.package3',
                                               repo_base=svn_repo.uri,
                                               metadata=package3_metadata))
        pkg3.run('%s %s/bin/easy_install -i %s/simple acme.er.package2'
                 % (pkg3.python, pkg3.virtualenv, pypi_chishop.uri))

        py_env = PythonInstallation(pkg3.python)
        egg = os.path.join(pkg3.virtualenv, 'lib',
                           'python' + py_env.short_version(2), 'site-packages',
                           'acme.er.package2-4.5.6-%s.egg' % py_env.py_version())
        name_to_revno = dict((name, str(revision))
                             for name, _, _, revision in read_allrevisions(egg))

        assert len(name_to_revno) == 2
        assert (name_to_revno['acme.er.package1'] ==
                _svn_info_revision(pkg3, pkg1.workspace, 'acme.er.package1'))
        assert (name_to_revno['acme.er.package2'] ==
                _svn_info_revision(pkg3, pkg2.workspace, 'acme.er.package2'))
Ejemplo n.º 4
0
def test_egg_revisions(pypi_chishop, svn_repo, workspace,
                       pytestconfig):  # @UnusedVariable # NOQA
    # pypi_chishop.restore()
    package1_metadata = dict(version='1.2.3', )
    package2_metadata = dict(version='4.5.6',
                             install_requires='acme.er.package1==1.2.3')
    package3_metadata = dict(version='7.8.9',
                             install_requires='acme.er.package2==4.5.6')

    with ExitStack() as stack:
        pkg1 = stack.enter_context(
            create_pkg(pypi_chishop,
                       svn_repo,
                       'acme.er.package1',
                       metadata=package1_metadata,
                       dev=False))
        pkg2 = stack.enter_context(
            create_pkg(pypi_chishop,
                       svn_repo,
                       'acme.er.package2',
                       metadata=package2_metadata,
                       dev=False))
        pkg3 = stack.enter_context(
            PkgTemplate(name='acme.package3',
                        repo_base=svn_repo.uri,
                        metadata=package3_metadata))
        pkg3.run('%s %s/bin/easy_install -i %s/simple acme.er.package2' %
                 (pkg3.python, pkg3.virtualenv, pypi_chishop.uri))

        py_env = PythonInstallation(pkg3.python)
        egg = os.path.join(
            pkg3.virtualenv, 'lib', 'python' + py_env.short_version(2),
            'site-packages',
            'acme.er.package2-4.5.6-%s.egg' % py_env.py_version())
        name_to_revno = dict(
            (name, str(revision))
            for name, _, _, revision in read_allrevisions(egg))

        assert len(name_to_revno) == 2
        assert (name_to_revno['acme.er.package1'] == _svn_info_revision(
            pkg3, pkg1.workspace, 'acme.er.package1'))
        assert (name_to_revno['acme.er.package2'] == _svn_info_revision(
            pkg3, pkg2.workspace, 'acme.er.package2'))