Skip to content

Commit

Permalink
make brownie test
Browse files Browse the repository at this point in the history
  • Loading branch information
0xalpharush committed Jan 11, 2023
1 parent bcc4293 commit 6c92aae
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/test_brownie.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import os
import shutil
import tempfile
import subprocess
import pytest
from typing import List

# cmd = [sys.executable, "-m", "pip", "install", "eth-brownie"]

import logging
LOGGER = logging.getLogger(__name__)

def run(command: List[str], cwd: str) -> int:
process = subprocess.run(
command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
executable=shutil.which(command[0]),
cwd=cwd,
check=True
)
LOGGER.info(process.stdout.decode("utf-8"))
LOGGER.error(process.stderr.decode("utf-8"))
return process.returncode

brownie_available = shutil.which("brownie") is not None
@pytest.mark.skip_if(not brownie_available)
def test_brownie():
initialize = ["brownie", "bake", "token"]
test = ["crytic-compile", ".", "--compile-force-framework", "brownie"]

with tempfile.TemporaryDirectory() as tmpdirname:

run(initialize, tmpdirname)

run(test,os.path.join(tmpdirname,"token")) == 0


0 comments on commit 6c92aae

Please sign in to comment.