Skip to content

Commit

Permalink
Fix conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
nick863 committed Jul 12, 2024
1 parent f9bf217 commit 851385c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/promptflow-evals/tests/evals/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,15 @@ def vcr_recording(request: pytest.FixtureRequest, user_object_id: str, tenant_id


def pytest_collection_modifyitems(items):
parents = {}
for item in items:
if item.get_closest_marker('azuretest'):
item.own_markers = [marker for marker in item.own_markers if marker.name != 'localtest']
# Check if parent contains 'localtest' marker and remove it.
if any(mark.name == 'localtest' for mark in item.parent.own_markers) or id(item.parent) in parents:
if id(item.parent) not in parents:
item.parent.own_markers = [
marker for marker in item.own_markers if getattr(marker, 'name', None) != 'localtest']
parents[id(item.parent)] = item.parent
if not item.get_closest_marker('azuretest'):
# If item's parent was marked as 'localtest', mark the child as such, but not if
# it was marked as 'azuretest'.
item.add_marker(pytest.mark.localtest)
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_individual_evaluator_prompt_based_with_dict_input(self, model_config):
assert score is not None
assert score["gpt_fluency"] > 0.0

@pytest.mark.azuretest
def test_individual_evaluator_service_based(self, project_scope, azure_cred):
eval_fn = ViolenceEvaluator(project_scope, azure_cred)
score = eval_fn(
Expand Down

0 comments on commit 851385c

Please sign in to comment.