Skip to content

Commit be217d6

Browse files
committed
coverage(cli): Remove static analysis and improve coverage pipeline
1 parent f3dfdae commit be217d6

File tree

4 files changed

+722
-5
lines changed

4 files changed

+722
-5
lines changed

.github/workflows/test_and_cov.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ jobs:
5656
pdm run coverage report -m
5757
pdm run coverage xml -i
5858
59-
- name: static analysis by basedpyright
60-
run: pdm run basedpyright
61-
6259
- name: upload coverage reports to codecov
6360
uses: codecov/codecov-action@v5
6461
with:

scripts/coverage.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
export EXTRA_COVERAGEPY_ARGS='--append'
4+
5+
make deps
6+
7+
pdm run coverage erase
8+
9+
# chroma 0.6.3
10+
EXTRA_LOCK_ARGS="--group chroma0" make coverage
11+
# default install (chroma 1.x)
12+
make coverage
13+
14+
pdm run coverage report -m

src/vectorcode/database/chroma.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
)
3333
from vectorcode.database.utils import get_collection_id, get_uuid, hash_file
3434

35-
if not chromadb.__version__.startswith("1."):
35+
if not chromadb.__version__.startswith("1."): # pragma: nocover
3636
logging.error(
3737
f"""
3838
Found ChromaDB {chromadb.__version__}, which is incompatible wiht your VectorCode installation. Please install `vectorcode`.
@@ -146,10 +146,13 @@ async def maybe_lock(self):
146146
"""
147147
Acquire a file (dir) lock if using persistent client.
148148
"""
149+
locked = False
149150
if self._lock is not None:
150151
await self._lock.acquire()
152+
locked = True
151153
yield
152-
if self._lock is not None:
154+
if locked:
155+
assert self._lock is not None
153156
await self._lock.release()
154157

155158
async def _create_or_get_collection(

0 commit comments

Comments
 (0)