fix: Resolve integration tests path issue

This commit is contained in:
Igor Ilic 2025-08-27 12:41:13 +02:00
parent 644116a2ce
commit eb65a89621
3 changed files with 10 additions and 16 deletions

View file

@ -2,6 +2,7 @@ import os
import sys
import uuid
import pytest
import pathlib
from unittest.mock import patch
from cognee.modules.chunking.TextChunker import TextChunker
@ -24,8 +25,7 @@ GROUND_TRUTH = [
@pytest.mark.asyncio
async def test_PdfDocument(mock_engine):
test_file_path = os.path.join(
os.sep,
*(os.path.dirname(__file__).split(os.sep)[:-2]),
pathlib.Path(__file__).parent.parent.parent,
"test_data",
"artificial-intelligence.pdf",
)

View file

@ -2,6 +2,7 @@ import os
import sys
import uuid
import pytest
import pathlib
from unittest.mock import patch
from cognee.modules.chunking.TextChunker import TextChunker
@ -34,10 +35,7 @@ GROUND_TRUTH = {
@pytest.mark.asyncio
async def test_TextDocument(mock_engine, input_file, chunk_size):
test_file_path = os.path.join(
os.sep,
*(os.path.dirname(__file__).split(os.sep)[:-2]),
"test_data",
input_file,
pathlib.Path(__file__).parent.parent.parent, "test_data", input_file
)
document = TextDocument(
id=uuid.uuid4(),

View file

@ -2,6 +2,7 @@ import os
import sys
import uuid
import pytest
import pathlib
from unittest.mock import patch
from cognee.modules.chunking.TextChunker import TextChunker
@ -18,31 +19,26 @@ chunk_by_sentence_module = sys.modules.get("cognee.tasks.chunks.chunk_by_sentenc
async def test_UnstructuredDocument(mock_engine):
# Define file paths of test data
pptx_file_path = os.path.join(
os.sep,
*(os.path.dirname(__file__).split(os.sep)[:-2]),
pathlib.Path(__file__).parent.parent.parent,
"test_data",
"example.pptx",
)
docx_file_path = os.path.join(
os.sep,
*(os.path.dirname(__file__).split(os.sep)[:-2]),
pathlib.Path(__file__).parent.parent.parent,
"test_data",
"example.docx",
)
csv_file_path = os.path.join(
os.sep,
*(os.path.dirname(__file__).split(os.sep)[:-2]),
pathlib.Path(__file__).parent.parent.parent,
"test_data",
"example.csv",
)
xlsx_file_path = os.path.join(
os.sep,
*(os.path.dirname(__file__).split(os.sep)[:-2]),
"test_data",
"example.xlsx",
pathlib.Path(__file__).parent.parent.parent,
"test_dataexample.xlsx",
)
# Define test documents