arcade-mcp/tests/install/README.md
Evan Tahler c034046735
Replace fcntl with cross-platform portalocker (fix win/powershell errors) (#739)
So even importing `fcntl` causes problems on windows. This PR replaces
fcntl with portalocker. Tests all pass, so I think we are good.

ref:
https://arcade-ai.slack.com/archives/C08K1SJ072S/p1767897850450239?thread_ts=1766186586.406019&cid=C08K1SJ072S

<img width="934" height="501" alt="Screenshot 2026-01-08 at 2 57 46 PM"
src="https://github.com/user-attachments/assets/1375b6b2-116c-44bd-bbe1-2157dd243d29"
/>

Closes ENGTOP-8

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Cross-platform file locking**
> 
> - Replace `fcntl` with `portalocker` in
`arcade_core/usage/identity.py` (shared/exclusive locks); switch to
atomic `os.replace()`
> - Add `portalocker` dependency and bump `arcade-core` to `4.2.1`
> 
> **Installation/CI**
> 
> - New GitHub Actions workflow `test-install.yml` runs install/CLI
checks on macOS, Windows, and Linux for Python 3.10/3.12
> - Add `tests/install/test_install.py` and README to verify install,
`arcade` CLI availability, and `portalocker` locking behavior
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3fe98fbcbf177f51fdb0b7fc51b20060f7fc85ad. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
2026-01-09 12:34:36 -08:00

4.1 KiB

Installation Tests

This directory contains tests to verify that arcade-mcp can be installed from source and works correctly across different platforms.

Overview

The installation test (test_install.py) verifies:

  1. Prerequisites: Checks that required tools (like uv) are available
  2. Installation: Installs arcade-mcp from source using uv
  3. CLI Functionality: Tests that the arcade CLI command is available and working
  4. File Locking: Verifies cross-platform file locking with portalocker (replacing fcntl)

Running Locally

Prerequisites

  • Python 3.10 or higher
  • uv installed and available in PATH

Quick Start

From the project root:

uv run python tests/install/test_install.py

Or if you have the package already installed:

python tests/install/test_install.py

Direct Execution

The script is executable, so you can also run it directly:

./tests/install/test_install.py

Or with Python:

python3 tests/install/test_install.py

What the Test Does

  1. Checks Prerequisites

    • Verifies uv is installed and available
  2. Installs Package

    • Syncs dependencies with uv sync --dev
    • Installs arcade-mcp in editable mode from source
  3. Tests CLI

    • Verifies arcade --help works
    • Tests arcade --version (optional)
    • Tests arcade whoami (may fail if not logged in, but shouldn't crash)
  4. Tests File Locking

    • Creates a temporary identity file
    • Tests shared lock for reading
    • Tests exclusive lock for writing
    • Verifies portalocker works cross-platform (Windows, macOS, Linux)

Expected Output

On success, you should see:

============================================================
Testing arcade-mcp Installation from Source
============================================================

Project root: /path/to/arcade-mcp

============================================================
Prerequisites Check
============================================================
✅ Success: Check uv availability

============================================================
Installation Phase
============================================================
✅ Success: Sync dependencies with uv
✅ Success: Install arcade-mcp from source (editable mode)

============================================================
CLI Functionality Tests
============================================================
✅ Success: Verify arcade CLI is available (--help)
✅ Success: Check arcade version
✅ Success: Test whoami command (no auth required)

============================================================
File Locking Tests (portalocker)
============================================================
✅ Success: Test portalocker file locking (cross-platform)

============================================================
Test Summary
============================================================
✅ PASSED: Check uv availability
✅ PASSED: Sync dependencies with uv
✅ PASSED: Install arcade-mcp from source (editable mode)
✅ PASSED: Verify arcade CLI is available (--help)
...

Total: X/X tests passed

🎉 All tests passed! arcade-mcp is working correctly.

Running in CI/CD

This test is automatically run in GitHub Actions on:

  • macOS (latest)
  • Windows (latest)
  • Linux (Ubuntu latest)

For Python versions: 3.10, 3.11, and 3.12

See .github/workflows/test-install.yml for the CI configuration.

Troubleshooting

uv not found

If you get an error that uv is not available:

# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

Or using pip:

pip install uv

Permission Denied

If you get a permission error when running the script directly:

chmod +x tests/install/test_install.py

Import Errors

If you see import errors, make sure you're running from the project root and that dependencies are installed:

uv sync --dev
  • .github/workflows/test-install.yml - GitHub Actions workflow
  • libs/arcade-core/arcade_core/usage/identity.py - File locking implementation using portalocker