def _create_sample_wheel(self, package_name, package_version): package_src = '{0}=={1}'.format(package_name, package_version) wagon_client = Wagon(package_src) return wagon_client.create( archive_destination_dir=tempfile.mkdtemp(dir=self.workdir), force=True)
def _put_n_plugins(self, number_of_plugins): for i in range(0, number_of_plugins): tmpdir = tempfile.mkdtemp(prefix='test-pagination-') with open(os.path.join(tmpdir, 'setup.py'), 'w') as f: f.write('from setuptools import setup\n') f.write('setup(name="some-package", version={0})'.format(i)) wagon = Wagon(tmpdir) plugin_path = wagon.create(archive_destination_dir=tmpdir) self.post_file('/plugins', plugin_path) shutil.rmtree(tmpdir)
def test_plugins_pagination(self): for i in range(1, 11): tmpdir = tempfile.mkdtemp(prefix='test-pagination-') with open(os.path.join(tmpdir, 'setup.py'), 'w') as f: f.write('from setuptools import setup\n') f.write('setup(name="some-package", version={0})'.format(i)) wagon = Wagon(tmpdir) plugin_path = wagon.create(archive_destination_dir=tmpdir) self.client.plugins.upload(plugin_path) shutil.rmtree(tmpdir) self._test_pagination(self.client.plugins.list)
def _create_wheel(self, package_name, package_version): module_src = '{0}=={1}'.format(package_name, package_version) wagon_client = Wagon(module_src) return wagon_client.create( archive_destination_dir=tempfile.gettempdir(), force=True)
def create_wheel(self, package_name, package_version): module_src = '{0}=={1}'.format(package_name, package_version) wagon_client = Wagon(module_src) return wagon_client.create( archive_destination_dir=tempfile.gettempdir(), force=True)
def _create_test_wagon(self, plugin_name): source_dir = resource('plugins/{0}'.format(plugin_name)) target_dir = tempfile.mkdtemp(dir=self.workdir) wagon_client = Wagon(source_dir) return wagon_client.create(archive_destination_dir=target_dir, force=True)
def _create_sample_wheel(self): src = util.get_resource_path('plugins/{0}'.format(TEST_PACKAGE_NAME)) wagon_client = Wagon(src) return wagon_client.create( archive_destination_dir=tempfile.mkdtemp(dir=self.workdir), force=True)