diff --git a/src/promptflow-evals/tests/evals/conftest.py b/src/promptflow-evals/tests/evals/conftest.py index 88a91288f84..cc98924e1b9 100644 --- a/src/promptflow-evals/tests/evals/conftest.py +++ b/src/promptflow-evals/tests/evals/conftest.py @@ -32,9 +32,9 @@ def is_replay(): return False -PROMOTFLOW_ROOT = Path(__file__) / "../../../.." -CONNECTION_FILE = (PROMOTFLOW_ROOT / "promptflow-evals/connections.json").resolve().absolute().as_posix() -RECORDINGS_TEST_CONFIGS_ROOT = Path(PROMOTFLOW_ROOT / "promptflow-recording/recordings/local").resolve() +PROMPTFLOW_ROOT = Path(__file__) / "../../../.." +CONNECTION_FILE = (PROMPTFLOW_ROOT / "promptflow-evals/connections.json").resolve().absolute().as_posix() +RECORDINGS_TEST_CONFIGS_ROOT = Path(PROMPTFLOW_ROOT / "promptflow-recording/recordings/local").resolve() def pytest_configure(): diff --git a/src/promptflow-tools/tests/conftest.py b/src/promptflow-tools/tests/conftest.py index f3a1b7e225d..333fec180f1 100644 --- a/src/promptflow-tools/tests/conftest.py +++ b/src/promptflow-tools/tests/conftest.py @@ -15,9 +15,9 @@ from promptflow.tools.aoai import AzureOpenAI from promptflow.tools.aoai_gpt4v import AzureOpenAI as AzureOpenAIVision -PROMOTFLOW_ROOT = Path(__file__).absolute().parents[1] -CONNECTION_FILE = (PROMOTFLOW_ROOT / "connections.json").resolve().absolute().as_posix() -root_str = str(PROMOTFLOW_ROOT.resolve().absolute()) +PROMPTFLOW_ROOT = Path(__file__).absolute().parents[1] +CONNECTION_FILE = (PROMPTFLOW_ROOT / "connections.json").resolve().absolute().as_posix() +root_str = str(PROMPTFLOW_ROOT.resolve().absolute()) if root_str not in sys.path: sys.path.insert(0, root_str) @@ -108,42 +108,42 @@ def skip_if_no_api_key(request, mocker): # example prompts @pytest.fixture def example_prompt_template() -> str: - with open(PROMOTFLOW_ROOT / "tests/test_configs/prompt_templates/marketing_writer/prompt.jinja2") as f: + with open(PROMPTFLOW_ROOT / "tests/test_configs/prompt_templates/marketing_writer/prompt.jinja2") as f: prompt_template = f.read() return prompt_template @pytest.fixture def example_prompt_template_with_name_in_roles() -> str: - with open(PROMOTFLOW_ROOT / "tests/test_configs/prompt_templates/prompt_with_name_in_roles.jinja2") as f: + with open(PROMPTFLOW_ROOT / "tests/test_configs/prompt_templates/prompt_with_name_in_roles.jinja2") as f: prompt_template = f.read() return prompt_template @pytest.fixture def chat_history() -> list: - with open(PROMOTFLOW_ROOT / "tests/test_configs/prompt_templates/marketing_writer/history.json") as f: + with open(PROMPTFLOW_ROOT / "tests/test_configs/prompt_templates/marketing_writer/history.json") as f: history = json.load(f) return history @pytest.fixture def example_prompt_template_with_function() -> str: - with open(PROMOTFLOW_ROOT / "tests/test_configs/prompt_templates/prompt_with_function.jinja2") as f: + with open(PROMPTFLOW_ROOT / "tests/test_configs/prompt_templates/prompt_with_function.jinja2") as f: prompt_template = f.read() return prompt_template @pytest.fixture def example_prompt_template_with_image() -> str: - with open(PROMOTFLOW_ROOT / "tests/test_configs/prompt_templates/prompt_with_image.jinja2") as f: + with open(PROMPTFLOW_ROOT / "tests/test_configs/prompt_templates/prompt_with_image.jinja2") as f: prompt_template = f.read() return prompt_template @pytest.fixture def example_image() -> Image: - with open(PROMOTFLOW_ROOT / "tests/test_configs/prompt_templates/images/number10.jpg", "rb") as f: + with open(PROMPTFLOW_ROOT / "tests/test_configs/prompt_templates/images/number10.jpg", "rb") as f: image = Image(f.read()) return image diff --git a/src/promptflow/tests/_constants.py b/src/promptflow/tests/_constants.py index e2295a675ab..7a96abec0e0 100644 --- a/src/promptflow/tests/_constants.py +++ b/src/promptflow/tests/_constants.py @@ -1,11 +1,11 @@ from pathlib import Path -PROMOTFLOW_ROOT = Path(__file__).parent.parent -RUNTIME_TEST_CONFIGS_ROOT = Path(PROMOTFLOW_ROOT / "tests/test_configs/runtime") -EXECUTOR_REQUESTS_ROOT = Path(PROMOTFLOW_ROOT / "tests/test_configs/executor_api_requests") -MODEL_ROOT = Path(PROMOTFLOW_ROOT / "tests/test_configs/e2e_samples") -CONNECTION_FILE = (PROMOTFLOW_ROOT / "connections.json").resolve().absolute().as_posix() -ENV_FILE = (PROMOTFLOW_ROOT / ".env").resolve().absolute().as_posix() +PROMPTFLOW_ROOT = Path(__file__).parent.parent +RUNTIME_TEST_CONFIGS_ROOT = Path(PROMPTFLOW_ROOT / "tests/test_configs/runtime") +EXECUTOR_REQUESTS_ROOT = Path(PROMPTFLOW_ROOT / "tests/test_configs/executor_api_requests") +MODEL_ROOT = Path(PROMPTFLOW_ROOT / "tests/test_configs/e2e_samples") +CONNECTION_FILE = (PROMPTFLOW_ROOT / "connections.json").resolve().absolute().as_posix() +ENV_FILE = (PROMPTFLOW_ROOT / ".env").resolve().absolute().as_posix() # below constants are used for pfazure and global config tests DEFAULT_SUBSCRIPTION_ID = "96aede12-2f73-41cb-b983-6d11a904839b"