Esempio 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')))
Esempio n. 2
0
  def test_pack_unhandled(self):
    parser = argparse.ArgumentParser()
    main_.add_argparse_options(parser)

    with util.temporary_directory('glyco-pack-test-') as tempdir:
      # DATA_DIR is not a package at all.
      options = parser.parse_args(['pack', DATA_DIR, '--output-dir', tempdir])
      self.assertTrue(pack.pack(options))
      self.assertEqual(len(os.listdir(tempdir)), 0)
Esempio n. 3
0
    def test_pack_unhandled(self):
        parser = argparse.ArgumentParser()
        main_.add_argparse_options(parser)

        with util.temporary_directory('glyco-pack-test-') as tempdir:
            # DATA_DIR is not a package at all.
            options = parser.parse_args(
                ['pack', DATA_DIR, '--output-dir', tempdir])
            self.assertTrue(pack.pack(options))
            self.assertEqual(len(os.listdir(tempdir)), 0)
Esempio n. 4
0
 def test_pack(self):
   parser = argparse.ArgumentParser()
   main_.add_argparse_options(parser)
   with util.temporary_directory(prefix='glyco-pack-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])
     # False is turned into the 0 (success) return code.
     self.assertFalse(pack.pack(options))
     self.assertEqual(len(os.listdir(tempdir)), 2)
Esempio n. 5
0
  def test_pack_partly_unhandled(self):
    parser = argparse.ArgumentParser()
    main_.add_argparse_options(parser)

    with util.temporary_directory('glyco-pack-test-') as tempdir:
      options = parser.parse_args(['pack',
                                   DATA_DIR,
                                   os.path.join(DATA_DIR, 'source_package'),
                                   '--output-dir', tempdir])
      self.assertTrue(pack.pack(options))
      # We should not have generated any wheel.
      self.assertEqual(len(os.listdir(tempdir)), 0)
Esempio n. 6
0
 def test_pack(self):
     parser = argparse.ArgumentParser()
     main_.add_argparse_options(parser)
     with util.temporary_directory(prefix='glyco-pack-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
         ])
         # False is turned into the 0 (success) return code.
         self.assertFalse(pack.pack(options))
         self.assertEqual(len(os.listdir(tempdir)), 2)
Esempio n. 7
0
    def test_pack_partly_unhandled(self):
        parser = argparse.ArgumentParser()
        main_.add_argparse_options(parser)

        with util.temporary_directory('glyco-pack-test-') as tempdir:
            options = parser.parse_args([
                'pack', DATA_DIR,
                os.path.join(DATA_DIR, 'source_package'), '--output-dir',
                tempdir
            ])
            self.assertTrue(pack.pack(options))
            # We should not have generated any wheel.
            self.assertEqual(len(os.listdir(tempdir)), 0)