Skip to content

Commit

Permalink
fix(test): install necessary vyper versions in test
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeshultz committed Mar 12, 2024
1 parent 27d8459 commit 47c72e9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from vvm import compile_source # type: ignore
from vvm.exceptions import VyperError # type: ignore

from ape_vyper.compiler import RuntimeErrorType
from ape_vyper.compiler import RuntimeErrorType, get_version_pragma_spec
from ape_vyper.exceptions import (
FallbackNotDefinedError,
IntegerOverflowError,
Expand Down Expand Up @@ -524,7 +524,17 @@ def test_compile_with_version_set_in_settings_dict(config, compiler_manager, pro
"pragma_with_space.vy",
],
)
def test_flatten_contract(project, contract_name, compiler):
def test_flatten_contract(all_versions, project, contract_name, compiler):
path = project.contracts_folder / contract_name
source = compiler.flatten_contract(path)

# Ensure the correct compiler version is installed
version_spec = get_version_pragma_spec(str(source))

if version_spec is None:
version = all_versions[-1]
else:
version = next(version_spec.filter(all_versions))

vvm.install_vyper(str(version))
vvm.compile_source(str(source), base_path=project.contracts_folder)

0 comments on commit 47c72e9

Please sign in to comment.