Skip to content

Commit d5536eb

Browse files
committed
fix(lint): add E402 per-file-ignores and fix import sorting for skipped test modules
Made-with: Cursor
1 parent a70490f commit d5536eb

6 files changed

Lines changed: 44 additions & 24 deletions

File tree

instrumentation-genai/opentelemetry-instrumentation-llamaindex/tests/test_embedding_instrumentation.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,25 @@
22

33
import pytest
44

5-
pytestmark = pytest.mark.skip(
6-
reason="Requires live OpenAI API key; needs VCR cassettes"
7-
)
8-
95
import os
106

117
from llama_index.core import Settings
128
from llama_index.core.callbacks import CallbackManager
139
from llama_index.embeddings.openai import OpenAIEmbedding
10+
1411
from opentelemetry import metrics, trace
12+
from opentelemetry.instrumentation.llamaindex import LlamaindexInstrumentor
1513
from opentelemetry.sdk.metrics import MeterProvider
1614
from opentelemetry.sdk.metrics.export import InMemoryMetricReader
1715
from opentelemetry.sdk.trace import TracerProvider
18-
from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor
19-
20-
from opentelemetry.instrumentation.llamaindex import LlamaindexInstrumentor
16+
from opentelemetry.sdk.trace.export import (
17+
ConsoleSpanExporter,
18+
SimpleSpanProcessor,
19+
)
2120

21+
pytestmark = pytest.mark.skip(
22+
reason="Requires live OpenAI API key; needs VCR cassettes"
23+
)
2224

2325
# Global setup - shared across tests
2426
metric_reader = None

instrumentation-genai/opentelemetry-instrumentation-llamaindex/tests/test_llm_instrumentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import os
44

55
import pytest
6-
76
from llama_index.core.llms import ChatMessage, MessageRole
87
from llama_index.core.llms.mock import MockLLM
8+
99
from opentelemetry import metrics, trace
1010
from opentelemetry.instrumentation.llamaindex import LlamaindexInstrumentor
1111
from opentelemetry.sdk.metrics import MeterProvider

instrumentation-genai/opentelemetry-instrumentation-llamaindex/tests/test_rag.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,10 @@
1111

1212
import pytest
1313

14-
pytestmark = pytest.mark.skip(
15-
reason="Requires live OpenAI API key; needs VCR cassettes"
16-
)
17-
1814
from llama_index.core import Document, Settings, VectorStoreIndex
1915
from llama_index.embeddings.openai import OpenAIEmbedding
2016
from llama_index.llms.openai import OpenAI
17+
2118
from opentelemetry import trace
2219
from opentelemetry.instrumentation.llamaindex import LlamaindexInstrumentor
2320
from opentelemetry.sdk.trace import TracerProvider
@@ -27,6 +24,10 @@
2724
SpanExportResult,
2825
)
2926

27+
pytestmark = pytest.mark.skip(
28+
reason="Requires live OpenAI API key; needs VCR cassettes"
29+
)
30+
3031

3132
class DebugSpanExporter(SpanExporter):
3233
"""Custom exporter that shows parent-child relationships clearly."""

instrumentation-genai/opentelemetry-instrumentation-llamaindex/tests/test_workflow_agent.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,30 @@
55
"""
66

77
import asyncio
8+
89
import pytest
910

10-
pytestmark = pytest.mark.skip(
11-
reason="Event stream already consumed errors; needs rework"
12-
)
1311
from typing import List
14-
from llama_index.core.agent import ReActAgent
12+
1513
from llama_index.core import Settings
16-
from llama_index.core.llms import MockLLM
14+
from llama_index.core.agent import ReActAgent
1715
from llama_index.core.base.llms.types import ChatMessage, MessageRole
16+
from llama_index.core.llms import MockLLM
1817
from llama_index.core.tools import FunctionTool
19-
from opentelemetry import trace, metrics
18+
19+
from opentelemetry import metrics, trace
2020
from opentelemetry.instrumentation.llamaindex import LlamaindexInstrumentor
21-
from opentelemetry.sdk.trace import TracerProvider
22-
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
23-
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter
2421
from opentelemetry.sdk.metrics import MeterProvider
2522
from opentelemetry.sdk.metrics.export import InMemoryMetricReader
23+
from opentelemetry.sdk.trace import TracerProvider
24+
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
25+
from opentelemetry.sdk.trace.export.in_memory_span_exporter import (
26+
InMemorySpanExporter,
27+
)
28+
29+
pytestmark = pytest.mark.skip(
30+
reason="Event stream already consumed errors; needs rework"
31+
)
2632

2733

2834
def multiply(a: int, b: int) -> int:

instrumentation-genai/opentelemetry-instrumentation-llamaindex/tests/test_workflow_agent_variants.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
import pytest
66

7-
pytestmark = pytest.mark.skip(
8-
reason="Event stream already consumed errors; needs rework"
7+
from llama_index.core.agent.workflow import (
8+
AgentWorkflow,
9+
CodeActAgent,
10+
FunctionAgent,
911
)
10-
from llama_index.core.agent.workflow import AgentWorkflow, CodeActAgent, FunctionAgent
1112
from llama_index.core.base.llms.types import (
1213
ChatMessage,
1314
ChatResponse,
@@ -17,6 +18,7 @@
1718
from llama_index.core.llms import MockLLM
1819
from llama_index.core.llms.llm import ToolSelection
1920
from llama_index.core.workflow import StartEvent, StopEvent, Workflow, step
21+
2022
from opentelemetry.instrumentation.llamaindex import LlamaindexInstrumentor
2123
from opentelemetry.sdk.metrics import MeterProvider
2224
from opentelemetry.sdk.trace import TracerProvider
@@ -25,6 +27,10 @@
2527
InMemorySpanExporter,
2628
)
2729

30+
pytestmark = pytest.mark.skip(
31+
reason="Event stream already consumed errors; needs rework"
32+
)
33+
2834

2935
class StaticChatLLM(MockLLM):
3036
def __init__(self, content: str):

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,11 @@ ignore = [
173173
[tool.ruff.lint.per-file-ignores]
174174
"docs/**/*.*" = ["A001"]
175175
"instrumentation-genai/opentelemetry-instrumentation-langchain/tests/test_callback_handler_agent.py" = ["E402"]
176+
"instrumentation-genai/opentelemetry-instrumentation-llamaindex/tests/test_embedding_instrumentation.py" = ["E402"]
177+
"instrumentation-genai/opentelemetry-instrumentation-llamaindex/tests/test_rag.py" = ["E402"]
178+
"instrumentation-genai/opentelemetry-instrumentation-llamaindex/tests/test_workflow_agent.py" = ["E402"]
179+
"instrumentation-genai/opentelemetry-instrumentation-llamaindex/tests/test_workflow_agent_variants.py" = ["E402"]
180+
"instrumentation-genai/opentelemetry-instrumentation-openai-agents-v2/tests/test_tracer.py" = ["E402"]
176181

177182
[tool.ruff.lint.isort]
178183
detect-same-package = false # to not consider instrumentation packages as first-party

0 commit comments

Comments
 (0)