-
Notifications
You must be signed in to change notification settings - Fork 872
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CLI] Resolve additional includes for flow serve (#1733)
# Description Please add an informative description that covers that changes made by the pull request and link all relevant issues. # All Promptflow Contribution checklist: - [ ] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [ ] Title of the pull request is clear and informative. - [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes. Signed-off-by: Brynn Yin <[email protected]>
- Loading branch information
1 parent
e6c817d
commit a5e4b98
Showing
3 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/promptflow/tests/sdk_cli_test/unittests/test_flow_serve.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
from sdk_cli_test.conftest import MODEL_ROOT | ||
|
||
from promptflow._cli._pf._flow import _resolve_python_flow_additional_includes | ||
|
||
|
||
@pytest.mark.unittest | ||
def test_flow_serve_resolve_additional_includes(): | ||
# Assert flow path not changed if no additional includes | ||
flow_path = (Path(MODEL_ROOT) / "web_classification").resolve().absolute().as_posix() | ||
resolved_flow_path = _resolve_python_flow_additional_includes(flow_path) | ||
assert flow_path == resolved_flow_path | ||
|
||
# Assert additional includes are resolved correctly | ||
flow_path = (Path(MODEL_ROOT) / "web_classification_with_additional_include").resolve().absolute().as_posix() | ||
resolved_flow_path = _resolve_python_flow_additional_includes(flow_path) | ||
|
||
assert (Path(resolved_flow_path) / "convert_to_dict.py").exists() | ||
assert (Path(resolved_flow_path) / "fetch_text_content_from_url.py").exists() | ||
assert (Path(resolved_flow_path) / "summarize_text_content.jinja2").exists() |