Skip to content

Commit 6c92aae

Browse files
committed
make brownie test
1 parent bcc4293 commit 6c92aae

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/test_brownie.py

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import os
2+
import shutil
3+
import tempfile
4+
import subprocess
5+
import pytest
6+
from typing import List
7+
8+
# cmd = [sys.executable, "-m", "pip", "install", "eth-brownie"]
9+
10+
import logging
11+
LOGGER = logging.getLogger(__name__)
12+
13+
def run(command: List[str], cwd: str) -> int:
14+
process = subprocess.run(
15+
command,
16+
stdout=subprocess.PIPE,
17+
stderr=subprocess.PIPE,
18+
executable=shutil.which(command[0]),
19+
cwd=cwd,
20+
check=True
21+
)
22+
LOGGER.info(process.stdout.decode("utf-8"))
23+
LOGGER.error(process.stderr.decode("utf-8"))
24+
return process.returncode
25+
26+
brownie_available = shutil.which("brownie") is not None
27+
@pytest.mark.skip_if(not brownie_available)
28+
def test_brownie():
29+
initialize = ["brownie", "bake", "token"]
30+
test = ["crytic-compile", ".", "--compile-force-framework", "brownie"]
31+
32+
with tempfile.TemporaryDirectory() as tmpdirname:
33+
34+
run(initialize, tmpdirname)
35+
36+
run(test,os.path.join(tmpdirname,"token")) == 0
37+
38+

0 commit comments

Comments
 (0)