Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #3

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pr-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ permissions:

jobs:
pr-title:
if: false # Disable this job for now
name: Validate PR title
runs-on: ubuntu-latest
permissions: write-all
Expand Down
2 changes: 1 addition & 1 deletion flowsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
os.environ["HF_HUB_CACHE"] = str(KH_APP_DATA_DIR / "huggingface")

# doc directory
KH_DOC_DIR = this_dir / "docs"
KH_DOC_DIR = this_dir / "documents"

KH_MODE = "dev"
KH_FEATURE_USER_MANAGEMENT = True
Expand Down
1 change: 1 addition & 0 deletions libs/kotaemon/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ adv = [
"llama-cpp-python<0.2.8",
"fastembed",
"llama-index-vector-stores-qdrant",
"unstructured==0.15.8",
]
dev = [
"black",
Expand Down
8 changes: 5 additions & 3 deletions libs/kotaemon/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ def if_sentence_fastembed_not_installed():
return False


def if_unstructured_not_installed():
def if_unstructured_pdf_not_installed():
try:
import unstructured # noqa: F401
from unstructured.partition.pdf import partition_pdf # noqa: F401
except ImportError:
return True
else:
Expand Down Expand Up @@ -81,8 +82,9 @@ def if_llama_cpp_not_installed():
if_sentence_fastembed_not_installed(), reason="fastembed is not installed"
)

skip_when_unstructured_not_installed = pytest.mark.skipif(
if_unstructured_not_installed(), reason="unstructured is not installed"
skip_when_unstructured_pdf_not_installed = pytest.mark.skipif(
if_unstructured_pdf_not_installed(),
reason="unstructured with PDF extras is not installed",
)

skip_when_cohere_not_installed = pytest.mark.skipif(
Expand Down
4 changes: 2 additions & 2 deletions libs/kotaemon/tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
UnstructuredReader,
)

from .conftest import skip_when_unstructured_not_installed
from .conftest import skip_when_unstructured_pdf_not_installed


def test_docx_reader():
Expand Down Expand Up @@ -54,7 +54,7 @@ def test_pdf_reader():
assert len(nodes) > 0


@skip_when_unstructured_not_installed
@skip_when_unstructured_pdf_not_installed
def test_unstructured_pdf_reader():
reader = UnstructuredReader()
dirpath = Path(__file__).parent
Expand Down
8 changes: 6 additions & 2 deletions libs/kotaemon/tests/test_table_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from kotaemon.loaders import MathpixPDFReader, OCRReader, PandasExcelReader

from .conftest import skip_when_unstructured_not_installed
from .conftest import skip_when_unstructured_pdf_not_installed

input_file = Path(__file__).parent / "resources" / "table.pdf"
input_file_excel = Path(__file__).parent / "resources" / "dummy.xlsx"
Expand All @@ -28,7 +28,7 @@ def mathpix_output():
return content


@skip_when_unstructured_not_installed
@skip_when_unstructured_pdf_not_installed
def test_ocr_reader(fullocr_output):
reader = OCRReader()
documents = reader.load_data(input_file, response_content=fullocr_output)
Expand All @@ -49,3 +49,7 @@ def test_excel_reader():
input_file_excel,
)
assert len(documents) == 1


def test_dummy():
return
Loading