From 71826e4a08c7cad3defa887867ca09b8068bdda6 Mon Sep 17 00:00:00 2001 From: Oliver Rice Date: Fri, 21 Jun 2024 16:11:35 -0500 Subject: [PATCH] ci round 4 --- .github/workflows/tests.yml | 1 + tests/conftest.py | 14 ++------------ tests/test_pinecone.py | 7 ++++--- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7cca84c..eaec36f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,6 +11,7 @@ on: jobs: test: runs-on: ubuntu-latest + environment: env strategy: matrix: python-version: ['3.9'] diff --git a/tests/conftest.py b/tests/conftest.py index bcd117a..9f48b26 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -113,18 +113,8 @@ def cursor(maybe_start_pg: None, postgres_connection_string: str): @pytest.fixture(scope="session") -def pinecone_apikey() -> Generator[str, None, None]: - try: - yield environ[pinecone.PINECONE_APIKEY] - except KeyError: - raise Exception( - "Pinecone APIKEY required to run the test suite. Create an API key and store it in an environment variable named {pinecone.PINECONE_APIKEY}. A free account is sufficient" - ) - - -@pytest.fixture(scope="session") -def pinecone_client(pinecone_apikey) -> Pinecone: - return Pinecone(api_key=pinecone_apikey) +def pinecone_client() -> Pinecone: + return Pinecone(api_key=environ[pinecone.PINECONE_APIKEY]) @pytest.fixture(scope="session") diff --git a/tests/test_pinecone.py b/tests/test_pinecone.py index 3ff90a0..14d56e9 100644 --- a/tests/test_pinecone.py +++ b/tests/test_pinecone.py @@ -1,9 +1,11 @@ +from os import environ + from pinecone import Pinecone from pinecone.data.index import Index from typer.testing import CliRunner from vec2pg.cli import app -from vec2pg.plugins.pinecone import to_qualified_table_name +from vec2pg.plugins.pinecone import PINECONE_APIKEY, to_qualified_table_name def test_pinecone_subcommand_does_not_error() -> None: @@ -20,7 +22,6 @@ def test_index_is_good(pinecone_index: Index) -> None: def test_pinecone_migrate( - pinecone_apikey, pinecone_namespace, pinecone_index_name, postgres_connection_string, @@ -32,7 +33,7 @@ def test_pinecone_migrate( [ "pinecone", "migrate", - pinecone_apikey, + environ[PINECONE_APIKEY], pinecone_index_name, pinecone_namespace, postgres_connection_string,