Skip to content

Commit

Permalink
Returned pytest.skip mark
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoughtseize1 committed Sep 20, 2024
1 parent 3bd4f5a commit 76d6943
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
1 change: 0 additions & 1 deletion generative_ai/rag/test_file.txt

This file was deleted.

22 changes: 7 additions & 15 deletions generative_ai/rag/test_rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@

import vertexai

# TODO(https://github.com/GoogleCloudPlatform/python-docs-samples/issues/11557): Remove once Allowlist is removed
pytest.skip(allow_module_level=True)

PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT")
LOCATION = "us-central1"
GCS_FILE = "gs://cloud-samples-data/generative-ai/pdf/earnings_statement.pdf"
Expand All @@ -43,23 +46,12 @@
vertexai.init(project=PROJECT_ID, location=LOCATION)


# @pytest.fixture(scope="module", name="test_file")
# def test_file_fixture() -> None:
# file_path = Path("./hello.txt")
# file_path.write_text("Hello World", encoding="utf-8")
# yield file_path.absolute().as_posix()
# file_path.unlink() # Delete the file after tests


# Try to work with existing file
@pytest.fixture(scope="module", name="test_file")
def test_file_fixture():
file_path = Path(__file__).parent / "test_file.txt"
print(file_path.absolute().as_posix())
if not file_path.exists():
pytest.fail(f"Required file {file_path} does not exist.")
def test_file_fixture() -> None:
file_path = Path("./hello.txt")
file_path.write_text("Hello World", encoding="utf-8")
yield file_path.absolute().as_posix()

file_path.unlink() # Delete the file after tests


@pytest.fixture(scope="module", name="test_corpus")
Expand Down

0 comments on commit 76d6943

Please sign in to comment.