Fix wrong type: build.versionCode is int

This commit is contained in:
linsui
2025-12-23 01:57:39 +08:00
parent 6aadd29c00
commit 1884d85e7e
2 changed files with 26 additions and 1 deletions

View File

@@ -1290,7 +1290,7 @@ def main():
)
continue
logging.info("...scanning versionCode " + build.versionCode)
logging.info(f"...scanning versionCode {build.versionCode}")
# Prepare the source code...
common.prepare_source(
vcs, app, build, build_dir, srclib_dir, extlib_dir, False

View File

@@ -81,6 +81,31 @@ class ScannerTest(SetUpTearDownMixin, unittest.TestCase):
super().setUp()
fdroidserver.scanner.ScannerTool.refresh_allowed = False
def test_looping_through_builds(self):
"""Exercises some of main() to get some coverage."""
appid = "com.example"
with (
tempfile.TemporaryDirectory() as tmpdir,
TmpCwd(tmpdir),
mock.patch("sys.argv", ["fdroid scanner", appid]),
mock.patch(
"fdroidserver.common.prepare_source", lambda v, a, b, d, s, e, r: None
),
):
os.mkdir("metadata")
pathlib.Path(f"metadata/{appid}.yml").write_text(
textwrap.dedent(
"""
RepoType: git
Builds:
- versionCode: 1
commit: v1.0
"""
)
)
fdroidserver.scanner.main()
self.assertTrue(os.path.exists("build"))
def test_scan_source_files(self):
fdroidserver.common.options = mock.Mock()
fdroidserver.common.options.json = False