|
|
@@ -87,3 +87,25 @@ def test_sdk_wheel_must_match_packaged_sources(context,tmp_path):
|
|
|
with pytest.raises(ValueError,match='SDK wheel differs'):
|
|
|
package.product_delivery(product,tmp_path/'output',td,exe,sdk_wheel=wheel)
|
|
|
assert not (tmp_path/'output').exists()
|
|
|
+
|
|
|
+def test_valid_optional_gui_archive_and_sdk_wheel(context,tmp_path):
|
|
|
+ product,_,td,exe,_,_,_,sdk=context
|
|
|
+ wheel=tmp_path/'fixture.whl'
|
|
|
+ with zipfile.ZipFile(wheel,'w') as z:
|
|
|
+ for path in sorted((sdk/'python').rglob('*.py')):
|
|
|
+ z.writestr(path.relative_to(sdk/'python').as_posix(),path.read_bytes())
|
|
|
+ members={exe.name:exe.read_bytes(),'gui-build-metadata.json':(exe.parent/'gui-build-metadata.json').read_bytes()}
|
|
|
+ files,modes=archive.finalize(members,{'profile':'gui','scope':'unit fixture'})
|
|
|
+ gui_zip=archive.write_archive(tmp_path/'gui.zip',files,modes)
|
|
|
+ result=package.product_delivery(product,tmp_path/'output',td,exe,gui_zip=gui_zip,sdk_wheel=wheel)
|
|
|
+ payload=archive.read_archive(result)['files']
|
|
|
+ assert payload[wheel.name]==wheel.read_bytes() and payload[gui_zip.name]==gui_zip.read_bytes()
|
|
|
+ assert json.loads(payload['RELEASE-IDENTITY.json'])['sdk_wheel_sha256']==package.sha(wheel)
|
|
|
+
|
|
|
+def test_other_gui_archive_is_rejected(context,tmp_path):
|
|
|
+ product,_,td,exe,_,_,_,_=context
|
|
|
+ files,modes=archive.finalize({exe.name:b'wrong EXE','gui-build-metadata.json':b'{}'},{'profile':'gui'})
|
|
|
+ gui_zip=archive.write_archive(tmp_path/'wrong-gui.zip',files,modes)
|
|
|
+ with pytest.raises(ValueError,match='optional GUI archive'):
|
|
|
+ package.product_delivery(product,tmp_path/'output',td,exe,gui_zip=gui_zip)
|
|
|
+ assert not (tmp_path/'output').exists()
|