Skip to content

Commit 6ac381e

Browse files
committed
tests: switch to ganache v7
1 parent b871435 commit 6ac381e

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ jobs:
4848
- name: Install dependencies
4949
run: |
5050
poetry install
51-
npm install -g ganache-cli
51+
# TODO: Update to stable ganache when released!
52+
npm install -g ganache@alpha
5253
- name: Test
5354
env:
5455
PROVIDER: ${{ secrets.MAINNET_PROVIDER }}

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY: test typecheck lint precommit docs
22

33
test:
4-
poetry run pytest -v --cov=uniswap --cov-report html --cov-report term --cov-report xml
4+
poetry run pytest -v --tb=line --maxfail=4 --cov=uniswap --cov-report html --cov-report term --cov-report xml
55

66
typecheck:
77
poetry run mypy --pretty

‎tests/test_uniswap.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ def web3(ganache: GanacheInstance):
6767

6868
@pytest.fixture(scope="module")
6969
def ganache() -> Generator[GanacheInstance, None, None]:
70-
"""Fixture that runs ganache-cli which has forked off mainnet"""
71-
if not shutil.which("ganache-cli"):
70+
"""Fixture that runs ganache which has forked off mainnet"""
71+
if not shutil.which("ganache"):
7272
raise Exception(
73-
"ganache-cli was not found in PATH, you can install it with `npm install -g ganache-cli`"
73+
"ganache was not found in PATH, you can install it with `npm install -g ganache`"
7474
)
7575
if "PROVIDER" not in os.environ:
7676
raise Exception(
@@ -79,7 +79,7 @@ def ganache() -> Generator[GanacheInstance, None, None]:
7979

8080
port = 10999
8181
p = subprocess.Popen(
82-
f"ganache-cli --port {port} -s test --networkId 1 --fork {os.environ['PROVIDER']}",
82+
f"ganache --port {port} -s test --networkId 1 --fork {os.environ['PROVIDER']}",
8383
shell=True,
8484
)
8585
# Address #1 when ganache is run with `-s test`, it starts with 100 ETH
@@ -105,7 +105,7 @@ class TestUniswap(object):
105105
ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"
106106

107107
# TODO: Detect mainnet vs rinkeby and set accordingly, like _get_token_addresses in the Uniswap class
108-
# For Mainnet testing (with `ganache-cli --fork` as per the ganache fixture)
108+
# For Mainnet testing (with `ganache --fork` as per the ganache fixture)
109109
eth = "0x0000000000000000000000000000000000000000"
110110
weth = Web3.toChecksumAddress("0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2")
111111
bat = Web3.toChecksumAddress("0x0D8775F648430679A709E98d2b0Cb6250d2887EF")

0 commit comments

Comments
 (0)