Skip to content

Commit

Permalink
test: DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Sep 27, 2024
1 parent 814c668 commit 832dcc0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
3 changes: 1 addition & 2 deletions ape_vyper/compiler/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,11 +523,10 @@ def init_coverage_profile(
def enrich_error(self, err: ContractLogicError) -> ContractLogicError:
return enrich_error(err)

# TODO: In 0.9, make sure project is a kwarg here.
def trace_source(
self, contract_source: ContractSource, trace: TraceAPI, calldata: HexBytes
) -> SourceTraceback:
frames = [t for t in trace.get_raw_frames()]
assert len(frames) > 0, frames
return SourceTracer.trace(trace.get_raw_frames(), contract_source, calldata)

def _get_compiler_arguments(
Expand Down
47 changes: 23 additions & 24 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import shutil
from contextlib import contextmanager
from pathlib import Path

Expand Down Expand Up @@ -152,29 +151,29 @@ def compiler(compiler_manager):
def project(config):
project_source_dir = Path(__file__).parent

root_project = ape.Project(project_source_dir)

# For increasing speed of debugging tests, allows not having
# to re-compile every time.
allow_cache = os.environ.get("APE_VYPER_TESTING_USE_CACHE", "0").lower() not in (
False,
"f",
0,
"0",
"false",
)

if allow_cache:
yield root_project

else:
# NOTE: This is what CI/CD does.
# Delete build / .cache that may exist pre-copy
cache = project_source_dir / ".build"
shutil.rmtree(cache, ignore_errors=True)

with root_project.isolate_in_tempdir() as tmp_project:
yield tmp_project
return ape.Project(project_source_dir)
#
# # For increasing speed of debugging tests, allows not having
# # to re-compile every time.
# allow_cache = os.environ.get("APE_VYPER_TESTING_USE_CACHE", "0").lower() not in (
# False,
# "f",
# 0,
# "0",
# "false",
# )
#
# if allow_cache:
# yield root_project
#
# else:
# # NOTE: This is what CI/CD does.
# # Delete build / .cache that may exist pre-copy
# cache = project_source_dir / ".build"
# shutil.rmtree(cache, ignore_errors=True)
#
# with root_project.isolate_in_tempdir() as tmp_project:
# yield tmp_project


@pytest.fixture
Expand Down

0 comments on commit 832dcc0

Please sign in to comment.