Skip to content

Commit

Permalink
tweak conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Oct 20, 2024
1 parent 7a1836a commit 4818988
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sources = pydantic_ai tests

.PHONY: install # Install the package, dependencies, and pre-commit for local development
install: .uv .pre-commit
uv sync --frozen
uv sync --frozen --all-extras
pre-commit install --install-hooks

.PHONY: format # Format the code
Expand Down
8 changes: 6 additions & 2 deletions demos/weather.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import json

from devtools import debug
import logfire

from pydantic_ai import Agent

logfire.configure()
try:
import logfire
except ImportError:
pass
else:
logfire.configure()

weather_agent: Agent[None, str] = Agent('openai:gpt-4o', system_prompt='Be concise, reply with one sentence.')

Expand Down
17 changes: 10 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@

__all__ = 'IsNow', 'TestEnv'

try:
import logfire
except ImportError:
pass
else:
logfire.configure(send_to_logfire=False)

if TYPE_CHECKING:

def IsNow(*args: Any, **kwargs: Any) -> datetime: ...
else:
from dirty_equals import IsNow

try:
from logfire.testing import CaptureLogfire
except ImportError:
pass
else:

@pytest.fixture(autouse=True)
def logfire_disable(capfire: CaptureLogfire):
pass


class TestEnv:
__test__ = False
Expand Down

0 comments on commit 4818988

Please sign in to comment.