diff --git a/.travis.yml b/.travis.yml index 14b0fe9..e7e4aeb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -105,6 +105,13 @@ matrix: env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.16 - python: "3.5" env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.16 + # solc 0.4.17 + - python: "2.7" + env: TOX_POSARGS="-e py27-stdlib -e py27-gevent" SOLC_VERSION=v0.4.17 + - python: "3.4" + env: TOX_POSARGS="-e py34-stdlib -e py34-gevent" SOLC_VERSION=v0.4.17 + - python: "3.5" + env: TOX_POSARGS="-e py35-stdlib -e py35-gevent" SOLC_VERSION=v0.4.17 cache: - pip: true before_install: diff --git a/tests/conftest.py b/tests/conftest.py index 15051ed..9a9a291 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,10 +13,14 @@ def contracts_dir(tmpdir): return str(tmpdir.mkdir("contracts")) +@pytest.fixture(scope="session") +def solc_version(): + return get_solc_version() + + @pytest.fixture() -def supported_solc_version(): - solc_version = get_solc_version() - if solc_version not in Spec('>=0.4.1,<=0.4.16,!=0.4.10,!=0.4.3,!=0.4.4,!=0.4.5'): +def supported_solc_version(solc_version): + if solc_version not in Spec('>=0.4.1,<=0.4.17,!=0.4.10,!=0.4.3,!=0.4.4,!=0.4.5'): raise AssertionError("Unsupported compiler version: {0}".format(solc_version)) return solc_version @@ -28,18 +32,31 @@ def is_new_key_format(): @pytest.fixture() -def FOO_SOURCE(supported_solc_version): - return textwrap.dedent('''\ - pragma solidity ^0.4.0; +def FOO_SOURCE(supported_solc_version, solc_version): + if solc_version in Spec('<0.4.17'): + return textwrap.dedent('''\ + pragma solidity ^0.4.0; - contract Foo { - function Foo() {} + contract Foo { + function Foo() {} - function return13() returns (uint) { - return 13; + function return13() public returns (uint) { + return 13; + } } - } - ''') + ''') + else: + return textwrap.dedent('''\ + pragma solidity ^0.4.17; + + contract Foo { + function Foo() public {} + + function return13() public pure returns (uint) { + return 13; + } + } + ''') @pytest.fixture() @@ -48,7 +65,7 @@ def BAR_SOURCE(supported_solc_version): pragma solidity ^0.4.0; contract Bar { - function Bar() {} + function Bar() public {} } ''') @@ -61,9 +78,9 @@ def BAZ_SOURCE(supported_solc_version): import "contracts/Bar.sol"; contract Baz is Bar { - function Baz() {} + function Baz() public {} - function get_funky() returns (string) { + function get_funky() public returns (string) { return "funky"; } }