Skip to content

Commit e1dda97

Browse files
committed
Switched to getuser for tests
1 parent b34f1c9 commit e1dda97

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tests/test_pg8000.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
from getpass import getuser
12
import numpy as np
2-
import os
33
from pgvector import HalfVector, SparseVector, Vector
44
from pgvector.pg8000 import register_vector
55
from pg8000.native import Connection
66

7-
conn = Connection(os.environ["USER"], database='pgvector_python_test')
7+
conn = Connection(getuser(), database='pgvector_python_test')
88

99
conn.run('CREATE EXTENSION IF NOT EXISTS vector')
1010
conn.run('DROP TABLE IF EXISTS pg8000_items')

tests/test_sqlalchemy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import asyncpg
2+
from getpass import getuser
23
import numpy as np
3-
import os
44
from pgvector import HalfVector, SparseVector, Vector
55
from pgvector.sqlalchemy import VECTOR, HALFVEC, BIT, SPARSEVEC, avg, sum
66
import pytest
@@ -28,7 +28,7 @@ def psycopg2_connect(dbapi_connection, connection_record):
2828
register_vector(dbapi_connection)
2929

3030

31-
pg8000_engine = create_engine(f'postgresql+pg8000://{os.environ["USER"]}@localhost/pgvector_python_test')
31+
pg8000_engine = create_engine(f'postgresql+pg8000://{getuser()}@localhost/pgvector_python_test')
3232

3333
if sqlalchemy_version > 1:
3434
psycopg_engine = create_engine('postgresql+psycopg://localhost/pgvector_python_test')

0 commit comments

Comments
 (0)