Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: skip agentify tests when git or internet is unavailable
  • Loading branch information
Yuchen Xiao Yuchen Xiao
Yuchen Xiao authored and Yuchen Xiao committed May 23, 2026
commit 043ddc66b68976c21cda6605f3cee63b874d9a99
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import json
import shutil
import socket
from pathlib import Path

import pytest
Expand All @@ -17,3 +19,15 @@ def user_filesystem(tmp_path):
json.dump(home_config_data, f)

yield tmp_path


def internet_available():
try:
socket.create_connection(("github.com", 443), timeout=3)
return True
except OSError:
return False


git_available = shutil.which("git") is not None
AGENTIFY_AVAILABLE = internet_available() and git_available
8 changes: 7 additions & 1 deletion tests/test_agentify.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@

import pytest

from diffpy.apps.app_agentify import agentify
from diffpy.apps.app_agentify import agentify, ensure_setup

pytestmark = pytest.mark.skipif(
not ensure_setup(),
reason="Internet connection or git unavailable. Skipping agentify tests.",
allow_module_level=True,
)


@pytest.mark.parametrize(
Expand Down