MCPcopy Create free account
hub / github.com/conda/constructor / test_payload_archive

Function test_payload_archive

tests/test_briefcase.py:226–244  ·  view source on GitHub ↗

Test that the payload archive function works as expected.

(tmp_path: Path)

Source from the content-addressed store, hash-verified

224
225@pytest.mark.skipif(sys.platform != "win32", reason="Windows only")
226def test_payload_archive(tmp_path: Path):
227 """Test that the payload archive function works as expected."""
228 info = mock_info.copy()
229 payload = Payload(info)
230
231 foo_dir = tmp_path / "foo"
232 foo_dir.mkdir()
233
234 expected_text = "some test text"
235 hello_file = foo_dir / "hello.txt"
236 hello_file.write_text(expected_text, encoding="utf-8")
237
238 archive_path = payload.make_archive(foo_dir, tmp_path)
239
240 with tarfile.open(archive_path, mode="r:gz") as tar:
241 member = tar.getmember("foo/hello.txt")
242 f = tar.extractfile(member)
243 assert f is not None
244 assert f.read().decode("utf-8") == expected_text
245
246
247@pytest.mark.skipif(sys.platform != "win32", reason="Windows only")

Callers

nothing calls this directly

Calls 2

make_archiveMethod · 0.95
PayloadClass · 0.90

Tested by

no test coverage detected