Exemplo n.º 1
0
  def test_install_two_packages(self):
    parser = argparse.ArgumentParser()
    main_.add_argparse_options(parser)

    with util.temporary_directory(prefix='glyco-install-test-') as tempdir:
      options = parser.parse_args(['pack',
                                   os.path.join(DATA_DIR, 'source_package'),
                                   os.path.join(DATA_DIR, 'installed_package'),
                                   '--output-dir', tempdir])
      self.assertFalse(pack.pack(options))
      wheel_paths = [os.path.join(tempdir, whl) for whl in os.listdir(tempdir)]

      options = parser.parse_args(
        ['install', wheel_paths[0], wheel_paths[1],
         '--install-dir', os.path.join(tempdir, 'local')])

      install.install(options)
      self.assertTrue(os.path.isdir(
        os.path.join(tempdir, 'local', 'source_package')))
      # Make sure the directory is not empty.
      self.assertTrue(
        len(os.listdir(os.path.join(tempdir, 'local', 'source_package'))) > 0)
      self.assertTrue(os.path.isdir(
          os.path.join(tempdir, 'local', 'source_package-0.0.1.dist-info')))

      self.assertTrue(os.path.isdir(
        os.path.join(tempdir, 'local', 'installed_package')))
      self.assertTrue(
        len(os.listdir(
          os.path.join(tempdir, 'local', 'installed_package'))) > 0)
      self.assertTrue(os.path.isdir(
          os.path.join(tempdir, 'local', 'installed_package-0.0.1.dist-info')))
Exemplo n.º 2
0
  def test_install_invalid_hash(self):
    parser = argparse.ArgumentParser()
    main_.add_argparse_options(parser)
    with util.temporary_directory(prefix='glyco-install-test-') as tempdir:
      options = parser.parse_args([
        'install', os.path.join(
            DATA_DIR, 'wheels', 'source_package_invalid_sha1-0.0.1-0_'
            + 'deadbeef3767ced3ec53b89b297e0268f1338b2b-py2-none-any.whl'),
        '--install-dir', os.path.join(tempdir, 'local')])

      result = install.install(options)

    self.assertNotEqual(result, 0)