xref: /aosp_15_r20/external/bazelbuild-rules_python/python/private/coverage.patch (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1*60517a1eSAndroid Build Coastguard Worker# Because of how coverage is run, the current directory is the first in
2*60517a1eSAndroid Build Coastguard Worker# sys.path. This is a problem for the tests, because they may import a module of
3*60517a1eSAndroid Build Coastguard Worker# the same name as a module in the current directory.
4*60517a1eSAndroid Build Coastguard Worker#
5*60517a1eSAndroid Build Coastguard Worker# NOTE @aignas 2023-06-05: we have to do this before anything from coverage gets
6*60517a1eSAndroid Build Coastguard Worker# imported.
7*60517a1eSAndroid Build Coastguard Workerdiff --git a/coverage/__main__.py b/coverage/__main__.py
8*60517a1eSAndroid Build Coastguard Workerindex ce2d8db..7d7d0a0 100644
9*60517a1eSAndroid Build Coastguard Worker--- a/coverage/__main__.py
10*60517a1eSAndroid Build Coastguard Worker+++ b/coverage/__main__.py
11*60517a1eSAndroid Build Coastguard Worker@@ -6,5 +6,6 @@
12*60517a1eSAndroid Build Coastguard Worker from __future__ import annotations
13*60517a1eSAndroid Build Coastguard Worker
14*60517a1eSAndroid Build Coastguard Worker import sys
15*60517a1eSAndroid Build Coastguard Worker+sys.path.append(sys.path.pop(0))
16*60517a1eSAndroid Build Coastguard Worker from coverage.cmdline import main
17*60517a1eSAndroid Build Coastguard Worker sys.exit(main())
18