Test git.archive on a subdir, giving only a partial copy of the repo in the resulting archive
(self)
| 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): |
nothing calls this directly
no test coverage detected