MCPcopy Index your code
hub / github.com/saltstack/salt / test_archive_subdir

Method test_archive_subdir

tests/integration/modules/test_git.py:215–239  ·  view source on GitHub ↗

Test git.archive on a subdir, giving only a partial copy of the repo in the resulting archive

(self)

Source from the content-addressed store, hash-verified

213
214 @pytest.mark.slow_test
215 def test_archive_subdir(self):
216 """
217 Test git.archive on a subdir, giving only a partial copy of the repo in
218 the resulting archive
219 """
220 tar_archive = os.path.join(RUNTIME_VARS.TMP, "test_archive.tar.gz")
221 try:
222 self.assertTrue(
223 self.run_function(
224 "git.archive",
225 [os.path.join(self.repo, "qux"), tar_archive],
226 prefix="foo/",
227 )
228 )
229 self.assertTrue(tarfile.is_tarfile(tar_archive))
230 with closing(tarfile.open(tar_archive, "r")) as tar_obj:
231 self.assertEqual(
232 sorted(salt.utils.data.decode(tar_obj.getnames())),
233 sorted(["foo", "foo/bar", "foo/baz", "foo/foo", "foo/питон"]),
234 )
235 finally:
236 try:
237 os.unlink(tar_archive)
238 except OSError:
239 pass
240
241 @pytest.mark.slow_test
242 def test_branch(self):

Callers

nothing calls this directly

Calls 3

run_functionMethod · 0.95
unlinkMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected