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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Changed
- `PocketICServer` now looks for the PocketIC binary in the `POCKET_IC_BIN` environment variable, or in the working directory, or on the PATH, in that order of precedence.


## 3.1.0 - 2025-04-28

### Added
Expand Down
7 changes: 5 additions & 2 deletions pocket_ic/pocket_ic_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import os
import shutil
import time
import requests
from typing import List, Optional
Expand All @@ -13,8 +14,8 @@ class PocketICServer:
"""
An object of this class represents a running PocketIC server. During instantiation,
a running server is discovered, or a new one is launched from the PocketIC binary,
which is assumed to be in your working directory or specified via the POCKET_IC_BIN
environment variable.
which is assumed to be specified via the POCKET_IC_BIN environment variable, be on your
PATH, or in your working directory, in that order of precedence.

All tests within a testsuite should use the same server, so the service
discovery mechanism uses the current process id. This means that only the first
Expand All @@ -29,6 +30,8 @@ def __init__(self) -> None:
pid = os.getpid()
if "POCKET_IC_BIN" in os.environ:
bin_path = os.environ["POCKET_IC_BIN"]
elif shutil.which("pocket-ic") is not None:
bin_path = "pocket-ic"
else:
bin_path = "./pocket-ic"

Expand Down