diff --git a/.gitea/workflows/mcp-tests.yml b/.gitea/workflows/mcp-tests.yml index 5b122ae..3ced0af 100644 --- a/.gitea/workflows/mcp-tests.yml +++ b/.gitea/workflows/mcp-tests.yml @@ -31,5 +31,4 @@ jobs: - name: Run MCP lint/format/tests via nix-shell run: | - repo_root="$PWD" - MCP_TESTS_WORKDIR="$repo_root" nix run .#mcp-tests + nix run .#mcp-tests diff --git a/parts/packages.nix b/parts/packages.nix index 0025619..13950a7 100644 --- a/parts/packages.nix +++ b/parts/packages.nix @@ -36,27 +36,7 @@ ruff ]; text = '' - start_dir="$PWD" - if [ -n "''${MCP_TESTS_WORKDIR:-}" ]; then - cd "''${MCP_TESTS_WORKDIR}" - elif [ -n "''${GITEA_WORKSPACE:-}" ]; then - cd "''${GITEA_WORKSPACE}" - elif [ -n "''${GITHUB_WORKSPACE:-}" ]; then - cd "''${GITHUB_WORKSPACE}" - elif command -v git >/dev/null 2>&1; then - repo_root="$(git rev-parse --show-toplevel 2>/dev/null || true)" - if [ -n "$repo_root" ]; then - cd "$repo_root" - fi - fi - while [ ! -x ./scripts/mcp-server/run-tests.sh ]; do - if [ "$PWD" = "/" ]; then - echo "Could not find executable scripts/mcp-server/run-tests.sh starting from $start_dir" >&2 - exit 1 - fi - cd .. - done - exec bash ./scripts/mcp-server/run-tests.sh "$@" + exec bash ${inputs.self}/scripts/mcp-server/run-tests.sh "$@" ''; }; in diff --git a/scripts/mcp-server/run-tests.sh b/scripts/mcp-server/run-tests.sh index ad18d58..51a3212 100755 --- a/scripts/mcp-server/run-tests.sh +++ b/scripts/mcp-server/run-tests.sh @@ -8,10 +8,13 @@ cd "$here" cache_root="${TMPDIR:-/tmp}/mcp-tests-cache" mkdir -p "$cache_root" +export HOME="${TMPDIR:-/tmp}/mcp-tests-home" +mkdir -p "$HOME" export XDG_CACHE_HOME="$cache_root/xdg" export RUFF_CACHE_DIR="$cache_root/ruff" export MYPY_CACHE_DIR="$cache_root/mypy" export PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} -o cache_dir=$cache_root/pytest" +export PYTHONDONTWRITEBYTECODE=1 fix=false for arg in "$@"; do