How to use _create_repo method in localstack

Best Python code snippet using localstack_python

test_bundlebuilder.py

Source:test_bundlebuilder.py Github

copy

Full Screen

...34 def _get_all_locale_files(self):35 expected = self._share_locale_files[:]36 expected.extend(self._activity_locale_files)37 return expected38 def _create_repo(self):39 cwd = os.getcwd()40 path = tempfile.mkdtemp()41 os.chdir(path)42 subprocess.check_call(["git", "init"])43 subprocess.check_call(["git", "config", "user.name", "Test Test"])44 subprocess.check_call(["git", "config", "user.email", "test@test.org"])45 for source in self._source_files:46 source_path = os.path.join(data_dir, "sample.activity", source)47 dest_path = os.path.join(path, source)48 try:49 os.makedirs(os.path.dirname(dest_path))50 except OSError:51 pass52 shutil.copyfile(source_path, dest_path)53 shutil.copymode(source_path, dest_path)54 subprocess.check_call(["git", "add", source])55 subprocess.check_call(["git", "commit", "-m", "Initial commit", "-a"])56 os.chdir(cwd)57 return path58 def _strip_root_dir(self, paths):59 return [path[path.find("/") + 1:] for path in paths]60 def _test_dist_xo(self, source_path, build_path):61 cwd = os.getcwd()62 os.chdir(build_path)63 setup_path = os.path.join(source_path, "setup.py")64 subprocess.call([setup_path, "dist_xo"])65 xo_path = os.path.join(build_path, "dist", "Sample-1.xo")66 filenames = zipfile.ZipFile(xo_path).namelist()67 stripped_filenames = self._strip_root_dir(filenames)68 expected = self._source_files[:]69 expected.extend(self._get_all_locale_files())70 self.assertItemsEqual(stripped_filenames, expected)71 os.chdir(cwd)72 def _test_dist_source(self, source_path, build_path):73 cwd = os.getcwd()74 os.chdir(build_path)75 setup_path = os.path.join(source_path, "setup.py")76 subprocess.call([setup_path, "dist_source"])77 xo_path = os.path.join(build_path, "dist", "Sample-1.tar.bz2")78 filenames = tarfile.open(name=xo_path, mode="r:bz2").getnames()79 stripped_filenames = self._strip_root_dir(filenames)80 self.assertItemsEqual(stripped_filenames, self._source_files)81 os.chdir(cwd)82 def _test_build(self, source_path, build_path):83 cwd = os.getcwd()84 os.chdir(build_path)85 setup_path = os.path.join(source_path, "setup.py")86 subprocess.call([setup_path, "build"])87 locale_path = os.path.join(build_path, "locale")88 filenames = []89 for root, dirs, files in os.walk(locale_path):90 rel_root = root[len(build_path) + 1:]91 filenames.extend([os.path.join(rel_root, name) for name in files])92 self.assertItemsEqual(filenames, self._get_all_locale_files())93 os.chdir(cwd)94 def _test_dev(self, source_path, build_path):95 activities_path = tempfile.mkdtemp()96 cwd = os.getcwd()97 os.chdir(build_path)98 os.environ["SUGAR_ACTIVITIES_PATH"] = activities_path99 setup_path = os.path.join(source_path, "setup.py")100 subprocess.call([setup_path, "dev"])101 activity_py_path = os.path.join(activities_path, "Sample.activity",102 "activity.py")103 self.assertTrue(os.path.exists(activity_py_path))104 os.chdir(cwd)105 def _test_genpot(self, source_path, build_path):106 cwd = os.getcwd()107 os.chdir(build_path)108 pot_path = os.path.join(source_path, "po", "Sample.pot")109 os.unlink(pot_path)110 setup_path = os.path.join(source_path, "setup.py")111 subprocess.call([setup_path, "genpot"])112 self.assertTrue(os.path.exists(pot_path))113 os.chdir(cwd)114 def _test_install(self, source_path, build_path):115 install_path = tempfile.mkdtemp()116 cwd = os.getcwd()117 os.chdir(build_path)118 setup_path = os.path.join(source_path, "setup.py")119 subprocess.call([setup_path, "install", "--prefix", install_path])120 filenames = []121 activity_dir = os.path.join(install_path, "share",122 "sugar", "activities", "Sample.activity")123 for root, dirs, files in os.walk(activity_dir):124 rel_root = root[len(activity_dir) + 1:]125 filenames.extend([os.path.join(rel_root, name) for name in files])126 expected = self._source_files[:]127 expected.extend(self._activity_locale_files)128 self.assertItemsEqual(filenames, expected)129 filenames = []130 share_dir = os.path.join(install_path, "share")131 locale_dir = os.path.join(share_dir, "locale")132 for root, dirs, files in os.walk(locale_dir):133 rel_root = root[len(share_dir) + 1:]134 for name in files:135 if "org.sugarlabs.Sample" in name:136 filenames.append(os.path.join(rel_root, name))137 self.assertItemsEqual(filenames, self._share_locale_files)138 os.chdir(cwd)139 def test_dist_xo_in_source(self):140 repo_path = self._create_repo()141 self._test_dist_xo(repo_path, repo_path)142 def test_dist_xo_out_of_source(self):143 repo_path = self._create_repo()144 build_path = tempfile.mkdtemp()145 self._test_dist_xo(repo_path, build_path)146 def test_dist_source_in_source(self):147 repo_path = self._create_repo()148 self._test_dist_source(repo_path, repo_path)149 def test_dist_source_out_of_source(self):150 repo_path = self._create_repo()151 build_path = tempfile.mkdtemp()152 self._test_dist_source(repo_path, build_path)153 def test_install_in_source(self):154 repo_path = self._create_repo()155 self._test_install(repo_path, repo_path)156 def test_install_out_of_source(self):157 repo_path = self._create_repo()158 build_path = tempfile.mkdtemp()159 self._test_install(repo_path, build_path)160 def test_build_in_source(self):161 repo_path = self._create_repo()162 self._test_build(repo_path, repo_path)163 def test_build_out_of_source(self):164 repo_path = self._create_repo()165 build_path = tempfile.mkdtemp()166 self._test_build(repo_path, build_path)167 def test_dev_in_source(self):168 repo_path = self._create_repo()169 self._test_genpot(repo_path, repo_path)170 def test_dev_out_of_source(self):171 repo_path = self._create_repo()172 build_path = tempfile.mkdtemp()173 self._test_dev(repo_path, build_path)174 def test_genpot_in_source(self):175 repo_path = self._create_repo()176 self._test_genpot(repo_path, repo_path)177 def test_genpot_out_of_source(self):178 repo_path = self._create_repo()179 build_path = tempfile.mkdtemp()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful