From 19422b997e6d17381b6bdccc155c0dabd0b9f691 Mon Sep 17 00:00:00 2001 From: Itamar Oren Date: Sat, 14 Jun 2025 15:29:02 -0700 Subject: [PATCH] Enable measuring test coverage for Python archive (.par) files ".par" files are another common(?) (at least at Meta) zip-based binary format for python applications. This change enables coverage to unpack and use the unpacked files under any .par archives as source files. we've been carrying this patch for years, so I thought I'd try to upstream it, as it could benefit any PAR users out there (and should be harmless for anyone else). --- coverage/files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coverage/files.py b/coverage/files.py index 21ba3f167..bdc3633b5 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -166,7 +166,7 @@ def zip_location(filename: str) -> tuple[str, str] | None: name is in the zipfile. """ - for ext in [".zip", ".whl", ".egg", ".pex"]: + for ext in [".zip", ".whl", ".egg", ".pex", ".par"]: zipbase, extension, inner = filename.partition(ext + sep(filename)) if extension: zipfile = zipbase + ext