Skip to content

Commit

Permalink
issue #74, fixe error exit code 1
Browse files Browse the repository at this point in the history
  • Loading branch information
JolanThomassin committed Mar 28, 2024
1 parent faba1b4 commit 8e48712
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions tests/test_db_generate_qna_crawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,16 @@ def test_generate_question_db_connection_fail(
json_template = "test json template"
mock_connect_db.return_value = None # Simulate a failed DB connection

# Create a temporary directory
test_dir = tempfile.mkdtemp()
# Call the function, but store its return value without unpacking
result = generate_question(
system_prompt,
user_prompt,
json_template,
project_db=None, # Pass None instead of the database connection
)

try:
self.assertIsNone(
generate_question(
system_prompt,
user_prompt,
json_template,
mock_connect_db.return_value,
)
)
finally:
# Remove the temporary directory after the test
shutil.rmtree(test_dir)
# Assert that the function returns None
self.assertIsNone(result)


if __name__ == "__main__":
Expand Down

0 comments on commit 8e48712

Please sign in to comment.