From 1e891a31ca5a7622a1f8425f4c86478ca68b0357 Mon Sep 17 00:00:00 2001 From: Thomas Wood Date: Mon, 13 May 2024 21:01:30 +0100 Subject: [PATCH] Allow tests to run correctly even when Harmony Python library is contained within harmonyapi repo as a submodule --- tests/test_convert_excel_openpyxl.py | 3 +++ tests/test_convert_excel_xlsxwriter.py | 3 +++ tests/test_convert_pdf.py | 4 ++++ tests/test_convert_text.py | 3 +++ tests/test_match.py | 7 +++++-- tests/test_match_mhc.py | 3 +++ tests/test_negator.py | 2 ++ 7 files changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/test_convert_excel_openpyxl.py b/tests/test_convert_excel_openpyxl.py index 530b6f2..9dc5d45 100644 --- a/tests/test_convert_excel_openpyxl.py +++ b/tests/test_convert_excel_openpyxl.py @@ -25,8 +25,11 @@ ''' +import sys import unittest +sys.path.append("../src") + from harmony import convert_excel_to_instruments from harmony.schemas.requests.text import RawFile diff --git a/tests/test_convert_excel_xlsxwriter.py b/tests/test_convert_excel_xlsxwriter.py index fd7b62e..b7c018f 100644 --- a/tests/test_convert_excel_xlsxwriter.py +++ b/tests/test_convert_excel_xlsxwriter.py @@ -25,11 +25,14 @@ ''' +import sys import unittest from harmony import convert_excel_to_instruments from harmony.schemas.requests.text import RawFile +sys.path.append("../src") + xlsx_gad_7_2_questions = RawFile.parse_obj({ "file_id": "1d66bce4b80c4b0eaefe33f00cddedef", "file_name": "GAD-7.xlsx", diff --git a/tests/test_convert_pdf.py b/tests/test_convert_pdf.py index bdfece0..fb33ea1 100644 --- a/tests/test_convert_pdf.py +++ b/tests/test_convert_pdf.py @@ -25,8 +25,11 @@ ''' +import sys import unittest +sys.path.append("../src") + from harmony import convert_pdf_to_instruments from harmony.schemas.requests.text import RawFile from harmony import download_models @@ -40,6 +43,7 @@ download_models() + class TestConvertPdf(unittest.TestCase): def test_single_instrument(self): diff --git a/tests/test_convert_text.py b/tests/test_convert_text.py index 01b4758..1dd9069 100644 --- a/tests/test_convert_text.py +++ b/tests/test_convert_text.py @@ -25,8 +25,11 @@ ''' +import sys import unittest +sys.path.append("../src") + from harmony import convert_text_to_instruments from harmony.schemas.requests.text import RawFile diff --git a/tests/test_match.py b/tests/test_match.py index f6d3333..b276df2 100644 --- a/tests/test_match.py +++ b/tests/test_match.py @@ -25,8 +25,11 @@ ''' +import sys import unittest +sys.path.append("../src") + from harmony import match_instruments from harmony.schemas.requests.text import Instrument, Question @@ -36,8 +39,8 @@ questions_pt = [Question( question_text="Durante as últimas 2 semanas, com que freqüência você foi incomodado/a pelos problemas abaixo?"), - Question( - question_text="Durante as últimas 2 semanas, com que freqüência você foi incomodado/a pelos problemas abaixo?")] + Question( + question_text="Durante as últimas 2 semanas, com que freqüência você foi incomodado/a pelos problemas abaixo?")] instrument_pt = Instrument(questions=questions_pt, language="pt") instrument_1 = Instrument.parse_obj({ diff --git a/tests/test_match_mhc.py b/tests/test_match_mhc.py index a01589e..7792598 100644 --- a/tests/test_match_mhc.py +++ b/tests/test_match_mhc.py @@ -25,8 +25,11 @@ ''' +import sys import unittest +sys.path.append("../src") + import numpy as np from sentence_transformers import SentenceTransformer diff --git a/tests/test_negator.py b/tests/test_negator.py index 0740984..c76b694 100644 --- a/tests/test_negator.py +++ b/tests/test_negator.py @@ -25,8 +25,10 @@ ''' +import sys import unittest +sys.path.append("../src") from harmony.matching.negator import negate