Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ exclude = [
]

[tool.pytest.ini_options]
testpaths = ["."]
testpaths = ["tests"]
python_files = "test_*.py"
python_classes = "Test*"
python_functions = "test_*"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,21 @@

from copilot import CopilotClient

from .proxy import CapiProxy
from .proxy import BASE_DIR, CapiProxy


def get_cli_path_for_tests() -> str:
"""Get CLI path for E2E tests. Uses node_modules CLI during development."""
# Look for CLI in sibling nodejs directory's node_modules
base_path = Path(__file__).parents[3]
full_path = base_path / "nodejs" / "node_modules" / "@github" / "copilot" / "index.js"
full_path = BASE_DIR / "nodejs" / "node_modules" / "@github" / "copilot" / "index.js"
if full_path.exists():
return str(full_path.resolve())

raise RuntimeError("CLI not found for tests. Run 'npm install' in the nodejs directory.")


CLI_PATH = get_cli_path_for_tests()
SNAPSHOTS_DIR = Path(__file__).parents[3] / "test" / "snapshots"
SNAPSHOTS_DIR = BASE_DIR / "test" / "snapshots"


class E2ETestContext:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
"""

import os
import pathlib
import platform
import re
import subprocess
from typing import Any, Optional

import httpx

BASE_DIR = pathlib.Path(__file__).parents[4]


class CapiProxy:
"""Manages a replaying proxy server for E2E tests."""
Expand All @@ -27,9 +30,7 @@ async def start(self) -> str:
return self._proxy_url

# The harness server is in the shared test directory
server_path = os.path.join(
os.path.dirname(__file__), "..", "..", "..", "test", "harness", "server.ts"
)
server_path = os.path.join(BASE_DIR / "test" / "harness" / "server.ts")
server_path = os.path.abspath(server_path)

# On Windows, use shell=True to find npx
Expand Down
2 changes: 1 addition & 1 deletion python/test_client.py → python/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"""

import pytest
from e2e.testharness import CLI_PATH

from copilot import CopilotClient
from e2e.testharness import CLI_PATH


class TestHandleToolCallRequest:
Expand Down
File renamed without changes.
File renamed without changes.