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