def test_build_in_virtualenv(self): from infi.execute import ExecutionError from urllib import urlretrieve with self.temporary_directory_context(): try: self.execute_assert_success("virtualenv virtualenv-python") except ExecutionError: raise SkipTest("Skipping because virtualenv does not work") virtualenv_dir = path.abspath( path.join(curdir, 'virtualenv-python')) bin_dir = path.join( virtualenv_dir, 'Scripts' if assertions.is_windows() else 'bin') python = path.join(bin_dir, 'python') with utils.chdir(PROJECT_ROOT): self.execute_assert_success( "{python} setup.py develop".format(python=python)) with patch.object(sys, "executable", new=python + '.exe' if assertions.is_windows() else python): with patch.object(sys, "real_prefix", new=sys.prefix, create=True): self.test_build_after_init()
def test_build_in_virtualenv(self): from infi.execute import ExecutionError with self.temporary_directory_context(): try: self.execute_assert_success("virtualenv --distribute virtualenv-python") except ExecutionError, error: raise SkipTest("Skipping because virtualenv does not work") virtualenv_dir = path.abspath(path.join(curdir, 'virtualenv-python')) bin_dir = path.join(virtualenv_dir, 'Scripts' if assertions.is_windows() else 'bin') python = path.join(bin_dir, 'python') with utils.chdir(PROJECT_ROOT): self.execute_assert_success("{python} setup.py develop".format(python=python)) with patch.object(sys, "executable", new=python+'.exe' if assertions.is_windows() else python): with patch.object(sys, "real_prefix", new=True, create=True): self.test_build_after_init()
def test_build__absolute_paths(self): from infi.projector.helper.assertions import is_windows from infi.projector.helper.utils import buildout_parameters_context with self.temporary_directory_context(): self.projector("repository init a.b.c none short long") self.projector("devenv relocate --absolute --commit-changes") self.projector("devenv build --use-isolated-python") self.assertTrue(path.exists(path.join("parts", "python"))) with open( path.join("bin", "python-script.py" if is_windows() else "python")) as fd: python_content = fd.read() self.assertFalse( python_content.startswith("#!parts/python/bin/python") and not is_windows())
def to_value(cls, package_set): items = [ "'{} = {}'".format(key, value) for key, value in package_set.items() ] items.sort(key=lambda s: s.lower()) newline = ',\r\n' if assertions.is_windows() else ',\n' return '[\n' + newline.join(items) + '\n]'
def test_build_in_virtualenv(self): from infi.execute import ExecutionError from urllib import urlretrieve with self.temporary_directory_context(): try: self.execute_assert_success("virtualenv virtualenv-python") except ExecutionError: raise SkipTest("Skipping because virtualenv does not work") virtualenv_dir = path.abspath(path.join(curdir, 'virtualenv-python')) bin_dir = path.join(virtualenv_dir, 'Scripts' if assertions.is_windows() else 'bin') python = path.join(bin_dir, 'python') urlretrieve("http://pypi01.infinidat.com/media/dists/ez_setup.py", "ez_setup.py") self.execute_assert_success("{python} ez_setup.py --download-base=http://pypi01.infinidat.com/media/dists/".format(python=python)) with utils.chdir(PROJECT_ROOT): self.execute_assert_success("{python} setup.py develop".format(python=python)) with patch.object(sys, "executable", new=python+'.exe' if assertions.is_windows() else python): with patch.object(sys, "real_prefix", new=True, create=True): self.test_build_after_init()
def test_build__absolute_paths(self): from infi.projector.helper.assertions import is_windows from infi.projector.helper.utils import buildout_parameters_context with self.temporary_directory_context(): self.projector("repository init a.b.c none short long") self.projector("devenv relocate --absolute --commit-changes") self.projector("devenv build --use-isolated-python --no-readline") self.assertTrue(path.exists(path.join("parts", "python"))) with open(path.join("bin", "python-script.py" if is_windows() else "python")) as fd: python_content = fd.read() self.assertFalse(python_content.startswith("#!parts/python/bin/python") and not is_windows())
def execute_assert_success(self, commandline_or_args): from infi.execute import execute_assert_success args = utils.parse_args(commandline_or_args) args[0] += '.exe' if assertions.is_windows() else '' return execute_assert_success(args)
def to_value(cls, package_set): newline = '\r\n' if assertions.is_windows() else '\n' return newline.join(list(set(package_set)))
def to_value(cls, package_set): items = [repr(item.replace(' ', '')) for item in set(package_set)] items.sort(key=lambda s: s.lower()) newline = ',\r\n' if assertions.is_windows() else ',\n' return '[\n' + newline.join(items) + '\n]'
def execute_assert_success(self, commandline_or_args): from infi.execute import execute_assert_success args = utils.parse_args(commandline_or_args) args[0] += '.exe' if assertions.is_windows() else '' execute_assert_success(args)
def to_value(cls, package_set): newline = "\r\n" if assertions.is_windows() else "\n" return newline.join(list(set(package_set)))
def to_value(cls, package_set): items = ["'{} = {}'".format(key, value) for key, value in package_set.items()] items.sort(key=lambda s: s.lower()) newline = ',\r\n' if assertions.is_windows() else ',\n' return '[\n' + newline.join(items) + '\n]'