예제 #1
0
 def setUp(self):
     super(TestValidate, self).setUp()
     self.runner = clicktest.CliRunner()
     self.packager = wagon.Wagon(TEST_PACKAGE, verbose=True)
     self.archive_path = self.packager.create(force=True)
     utils.untar(self.archive_path, '.')
     with open(os.path.join(TEST_PACKAGE_NAME, wagon.METADATA_FILE_NAME),
               'r') as f:
         self.m = json.loads(f.read())
예제 #2
0
 def setUp(self):
     super(TestValidate, self).setUp()
     self.runner = clicktest.CliRunner()
     self.packager = wagon.Wagon(TEST_PACKAGE, verbose=True)
     self.archive_path = self.packager.create(force=True)
     utils.untar(self.archive_path, '.')
     with open(os.path.join(
             TEST_PACKAGE_NAME,
             wagon.METADATA_FILE_NAME), 'r') as f:
         self.m = json.loads(f.read())
예제 #3
0
    def _test(self):
        # self.assertIn(self.archive_name, os.listdir('.'))
        self.assertTrue(os.path.isfile(self.archive_name))
        try:
            utils.untar(self.archive_name, '.')
        except:
            utils.unzip(self.archive_name, '.')
        with open(os.path.join(
                self.package_name,
                wagon.METADATA_FILE_NAME), 'r') as f:
            m = json.loads(f.read())

        self.assertEqual(m['package_version'], self.package_version)
        self.assertEqual(m['package_name'], self.package_name)
        self.assertEqual(m['supported_platform'], self.wagon.platform)
        if hasattr(self, 'excluded_package'):
            self.assertTrue(len(m['wheels']) >= 7)
        else:
            self.assertTrue(len(m['wheels']) >= 8)

        if utils.IS_LINUX and self.wagon.platform != 'any':
            distro, version, release = utils.get_os_properties()
            self.assertEqual(
                m['build_server_os_properties']['distribution'],
                distro.lower())
            self.assertEqual(
                m['build_server_os_properties']['distribution_version'],
                version.lower())
            self.assertEqual(
                m['build_server_os_properties']['distribution_release'],
                release.lower())

        self.assertIn(
            '{0}-{1}-{2}-none-{3}'.format(
                self.package_name.replace('-', '_'),
                self.package_version,
                '.'.join(self.wagon.python_versions),
                self.wagon.platform),
            m['archive_name'])

        self.assertTrue(os.path.isfile(os.path.join(
            self.package_name, wagon.DEFAULT_WHEELS_PATH,
            '{0}-{1}-py2-none-any.whl'.format(
                self.package_name.replace('-', '_'),
                self.package_version))))

        return m
예제 #4
0
    def _test(self):
        # self.assertIn(self.archive_name, os.listdir('.'))
        self.assertTrue(os.path.isfile(self.archive_name))
        try:
            utils.untar(self.archive_name, '.')
        except:
            utils.unzip(self.archive_name, '.')
        with open(os.path.join(self.package_name, wagon.METADATA_FILE_NAME),
                  'r') as f:
            m = json.loads(f.read())

        self.assertEqual(m['package_version'], self.package_version)
        self.assertEqual(m['package_name'], self.package_name)
        self.assertEqual(m['supported_platform'], self.wagon.platform)
        if hasattr(self, 'excluded_package'):
            self.assertTrue(len(m['wheels']) >= 7)
        else:
            self.assertTrue(len(m['wheels']) >= 8)

        if utils.IS_LINUX and self.wagon.platform != 'any':
            distro, version, release = utils.get_os_properties()
            self.assertEqual(m['build_server_os_properties']['distribution'],
                             distro.lower())
            self.assertEqual(
                m['build_server_os_properties']['distribution_version'],
                version.lower())
            self.assertEqual(
                m['build_server_os_properties']['distribution_release'],
                release.lower())

        self.assertIn(
            '{0}-{1}-{2}-none-{3}'.format(self.package_name.replace('-', '_'),
                                          self.package_version,
                                          '.'.join(self.wagon.python_versions),
                                          self.wagon.platform),
            m['archive_name'])

        self.assertTrue(
            os.path.isfile(
                os.path.join(
                    self.package_name, wagon.DEFAULT_WHEELS_PATH,
                    '{0}-{1}-py2-none-any.whl'.format(
                        self.package_name.replace('-', '_'),
                        self.package_version))))

        return m