def test_install_without_pbr(self):
        # Test easy-install of a thing that depends on a thing using pbr
        tempdir = self.useFixture(fixtures.TempDir()).path
        # A directory containing sdists of the things we're going to depend on
        # in using-package.
        dist_dir = os.path.join(tempdir, 'distdir')
        os.mkdir(dist_dir)
        self._run_cmd(sys.executable, ('setup.py', 'sdist', '-d', dist_dir),
                      allow_fail=False,
                      cwd=PBR_ROOT)
        # testpkg - this requires a pbr-using package
        test_pkg_dir = os.path.join(tempdir, 'testpkg')
        os.mkdir(test_pkg_dir)
        pkgs = {
            'pkgTest': {
                'setup.py':
                textwrap.dedent("""\
                    #!/usr/bin/env python
                    import setuptools
                    setuptools.setup(
                        name = 'pkgTest',
                        tests_require = ['pkgReq'],
                        test_suite='pkgReq'
                    )
                """),
                'setup.cfg':
                textwrap.dedent("""\
                    [easy_install]
                    find_links = %s
                """ % dist_dir)
            },
            'pkgReq': {
                'requirements.txt':
                textwrap.dedent("""\
                    pbr
                """),
                'pkgReq/__init__.py':
                textwrap.dedent("""\
                    print("FakeTest loaded and ran")
                """)
            },
        }
        pkg_dirs = self.useFixture(
            test_packaging.CreatePackages(pkgs)).package_dirs
        test_pkg_dir = pkg_dirs['pkgTest']
        req_pkg_dir = pkg_dirs['pkgReq']

        self._run_cmd(sys.executable, ('setup.py', 'sdist', '-d', dist_dir),
                      allow_fail=False,
                      cwd=req_pkg_dir)
        # A venv to test within
        venv = self.useFixture(test_packaging.Venv('nopbr', ['pip', 'wheel']))
        python = venv.python
        # Run the depending script
        self.useFixture(
            base.CapturedSubprocess('nopbr', [python] + ['setup.py', 'test'],
                                    cwd=test_pkg_dir))
 def test_pip_versions(self):
     pkgs = {
         'test_markers': {
             'requirements.txt':
             textwrap.dedent("""\
                 pkg_a; python_version=='1.2'
                 pkg_b; python_version!='1.2'
             """)
         },
         'pkg_a': {},
         'pkg_b': {},
     }
     pkg_dirs = self.useFixture(
         test_packaging.CreatePackages(pkgs)).package_dirs
     temp_dir = self.useFixture(fixtures.TempDir()).path
     repo_dir = os.path.join(temp_dir, 'repo')
     venv = self.useFixture(test_packaging.Venv('markers'))
     bin_python = venv.python
     os.mkdir(repo_dir)
     for module in self.modules:
         self._run_cmd(bin_python,
                       ['-m', 'pip', 'install', '--upgrade', module],
                       cwd=venv.path,
                       allow_fail=False)
     for pkg in pkg_dirs:
         self._run_cmd(bin_python, ['setup.py', 'sdist', '-d', repo_dir],
                       cwd=pkg_dirs[pkg],
                       allow_fail=False)
     self._run_cmd(bin_python, [
         '-m', 'pip', 'install', '--no-index', '-f', repo_dir,
         'test_markers'
     ],
                   cwd=venv.path,
                   allow_fail=False)
     self.assertIn(
         'pkg-b',
         self._run_cmd(bin_python, ['-m', 'pip', 'freeze'],
                       cwd=venv.path,
                       allow_fail=False)[0])