annotate tests/sitecustomize.py @ 51274:bec6e9c108fd

matchers: use correct method for finding index in vector The path matcher has an optimization for when all paths are `rootfilesin:`. This optimization exists in both Python and Rust. However, the Rust implementation currently has a bug that makes it fail in most cases. The bug is that it `rfind()` where it was clearly intended to use `rposition()`. This patch fixes that and adds a test.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 18 Dec 2023 14:51:20 -0800
parents 6000f5b25c9b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24505
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
1 import os
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
2
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
3 if os.environ.get('COVERAGE_PROCESS_START'):
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
4 try:
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
5 import coverage
30477
d2c40510104e tests: update sitecustomize to use uuid1() instead of randrange()
Augie Fackler <augie@google.com>
parents: 28946
diff changeset
6 import uuid
24505
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
7
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 30477
diff changeset
8 covpath = os.path.join(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 30477
diff changeset
9 os.environ['COVERAGE_DIR'], 'cov.%s' % uuid.uuid1()
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 30477
diff changeset
10 )
24505
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
11 cov = coverage.coverage(data_file=covpath, auto_data=True)
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
12 cov._warn_no_data = False
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
13 cov._warn_unimported_source = False
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
14 cov.start()
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
15 except ImportError:
031947baf4d0 run-tests: collect aggregate code coverage
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14971
diff changeset
16 pass