Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
47 changes: 32 additions & 15 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -48,7 +65,7 @@ def BAR_SOURCE(supported_solc_version):
pragma solidity ^0.4.0;

contract Bar {
function Bar() {}
function Bar() public {}
}
''')

Expand All @@ -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";
}
}
Expand Down