D11 replaces an installed plugin only when the shipped manifest is newer, but the manifest version was kept by hand and still said 1.0.0.1, the version of a test build installed before the snapshot sharing and appPath fixes, so that stale plugin was never replaced. Directory.Build.props now holds the only version, 1.0.1; publish.py stamps it into the shipped manifest and the app shows it in its title. Tests that waited on real time (file retry, popup expiry) use controlled timers, and real process waits have wider margins. Refs #1
35 lines
1.4 KiB
Python
35 lines
1.4 KiB
Python
"""Check release assembly and manifest versions without invoking NativeAOT."""
|
|
import contextlib
|
|
import io
|
|
import json
|
|
from pathlib import Path
|
|
import tempfile
|
|
import unittest
|
|
from unittest.mock import patch
|
|
import xml.etree.ElementTree as ET
|
|
|
|
import publish
|
|
|
|
|
|
class PublishTests(unittest.TestCase):
|
|
def test_published_manifest_uses_shared_version(self):
|
|
def fake_publish(command, **kwargs):
|
|
stage = Path(command[command.index('-o') + 1])
|
|
stage.mkdir(parents=True)
|
|
(stage / (stage.name + '.exe')).write_bytes(b'synthetic executable')
|
|
|
|
with tempfile.TemporaryDirectory(prefix='finaltoken-publish-test-') as temporary:
|
|
output = Path(temporary) / 'package'
|
|
with patch('sys.argv', ['publish.py', 'win-x64', '--out', str(output)]), \
|
|
patch.object(publish.subprocess, 'run', side_effect=fake_publish), \
|
|
contextlib.redirect_stdout(io.StringIO()):
|
|
publish.main()
|
|
version = ET.parse(Path(publish.__file__).resolve().parent.parent / 'Directory.Build.props').findtext('.//Version')
|
|
self.assertIsNotNone(version)
|
|
manifest = json.loads((output / 'streamdeck/de.finalfactory.finaltoken.sdPlugin/manifest.json').read_text(encoding='utf-8'))
|
|
self.assertEqual(version + '.0', manifest['Version'])
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|