fix: build test on mac by updating to python3.10 (#1437)

This commit is contained in:
mmsqe 2022-11-09 20:46:40 +08:00 committed by GitHub
parent cb632c6bef
commit ff0c969653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 932 additions and 661 deletions

View File

@ -27,7 +27,7 @@ import sources.nixpkgs {
dotenv = builtins.path { name = "dotenv"; path = ../scripts/.env; }; dotenv = builtins.path { name = "dotenv"; path = ../scripts/.env; };
}; };
}) })
(_: pkgs: { test-env = import ./testenv.nix { inherit pkgs; }; }) (_: pkgs: { test-env = pkgs.callPackage ./testenv.nix { }; })
(_: pkgs: { (_: pkgs: {
cosmovisor = pkgs.buildGo118Module rec { cosmovisor = pkgs.buildGo118Module rec {
name = "cosmovisor"; name = "cosmovisor";

View File

@ -41,10 +41,10 @@
"homepage": "", "homepage": "",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f904e3562aabca382d12f8471ca2330b3f82899a", "rev": "ea2c6a6dda1aa35a80139a512a9dee375b0946e7",
"sha256": "1lsa3sjwp1v3nv2jjpkl5lf9dncplwihmavasalg9fq1217pmzmb", "sha256": "0nd4nn9ryqa80ssw3j2kmr8wa73p2xz1hyxp280cdzqlmdfgw1lm",
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/f904e3562aabca382d12f8471ca2330b3f82899a.tar.gz", "url": "https://github.com/NixOS/nixpkgs/archive/ea2c6a6dda1aa35a80139a512a9dee375b0946e7.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
} }
} }

View File

@ -1,18 +1,38 @@
{ pkgs }: { poetry2nix, lib, python310 }:
pkgs.poetry2nix.mkPoetryEnv { poetry2nix.mkPoetryEnv {
projectDir = ../tests/integration_tests; projectDir = ../tests/integration_tests;
python = pkgs.python39; python = python310;
overrides = pkgs.poetry2nix.overrides.withDefaults (self: super: { overrides = poetry2nix.overrides.withDefaults (lib.composeManyExtensions [
eth-bloom = super.eth-bloom.overridePythonAttrs { (self: super:
preConfigure = '' let
substituteInPlace setup.py --replace \'setuptools-markdown\' "" buildSystems = {
''; eth-bloom = [ "setuptools" ];
}; pystarport = [ "poetry" ];
durations = [ "setuptools" ];
pystarport = super.pystarport.overridePythonAttrs ( multitail2 = [ "setuptools" ];
old: { pytest-github-actions-annotate-failures = [ "setuptools" ];
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.poetry ]; flake8-black = [ "setuptools" ];
} multiaddr = [ "setuptools" ];
); };
}); in
lib.mapAttrs
(attr: systems: super.${attr}.overridePythonAttrs
(old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ map (a: self.${a}) systems;
}))
buildSystems
)
(self: super: {
eth-bloom = super.eth-bloom.overridePythonAttrs {
preConfigure = ''
substituteInPlace setup.py --replace \'setuptools-markdown\' ""
'';
};
pyyaml-include = super.pyyaml-include.overridePythonAttrs {
preConfigure = ''
substituteInPlace setup.py --replace "setup()" "setup(version=\"1.3\")"
'';
};
})
]);
} }

File diff suppressed because it is too large Load Diff

View File

@ -6,22 +6,22 @@ authors = ["chain-dev <chain@crypto.com>"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.8" python = "^3.8"
pytest = "^7.0.1" pytest = "7.1.1"
pytest-github-actions-annotate-failures = "^0.1.1" pytest-github-actions-annotate-failures = "^0.1.1"
flake8 = "^4.0.1" flake8 = "^4.0.1"
black = "^22.3.0" black = "^22.3.0"
flake8-black = "^0.3.2" flake8-black = "^0.3.2"
flake8-isort = "^4.1.1" flake8-isort = "^4.1.1"
pep8-naming = "^0.11.1" pep8-naming = "^0.11.1"
protobuf = "^3.20.2" protobuf = "^3.13.0"
grpcio = "^1.33.2" grpcio = "^1.33.2"
PyYAML = "^5.3.1" PyYAML = "^5.3.1"
python-dateutil = "^2.8.1" python-dateutil = "^2.8.1"
web3 = "^5.20.1" web3 = "^6.0.0b6"
eth-bloom = "^1.0.4" eth-bloom = "^1.0.4"
python-dotenv = "^0.19.2" python-dotenv = "^0.19.2"
pystarport = { git = "https://github.com/crypto-com/pystarport.git", branch = "main" } pystarport = { git = "https://github.com/crypto-com/pystarport.git", branch = "main" }
websockets = "^9.1" websockets = "^10.3"
toml = "^0.10.2" toml = "^0.10.2"
pysha3 = "^1.0.2" pysha3 = "^1.0.2"
jsonnet = "^0.18.0" jsonnet = "^0.18.0"

View File

@ -55,7 +55,7 @@ def test_event_log_filter_by_contract(cluster):
assert flt.get_all_entries() == [] # GetFilterLogs assert flt.get_all_entries() == [] # GetFilterLogs
# with tx # with tx
tx = contract.functions.setGreeting("world").buildTransaction() tx = contract.functions.setGreeting("world").build_transaction()
tx_receipt = send_transaction(w3, tx) tx_receipt = send_transaction(w3, tx)
assert tx_receipt.status == 1 assert tx_receipt.status == 1
@ -92,7 +92,7 @@ def test_event_log_filter_by_address(cluster):
assert flt.get_all_entries() == [] # GetFilterLogs assert flt.get_all_entries() == [] # GetFilterLogs
# with tx # with tx
tx = contract.functions.setGreeting("world").buildTransaction() tx = contract.functions.setGreeting("world").build_transaction()
receipt = send_transaction(w3, tx) receipt = send_transaction(w3, tx)
assert receipt.status == 1 assert receipt.status == 1
@ -110,7 +110,7 @@ def test_get_logs(cluster):
assert w3.eth.get_logs({"address": ADDRS["validator"]}) == [] assert w3.eth.get_logs({"address": ADDRS["validator"]}) == []
# with tx # with tx
tx = contract.functions.setGreeting("world").buildTransaction() tx = contract.functions.setGreeting("world").build_transaction()
receipt = send_transaction(w3, tx) receipt = send_transaction(w3, tx)
assert receipt.status == 1 assert receipt.status == 1

View File

@ -39,7 +39,7 @@ def test_pruned_node(pruned):
CONTRACTS["TestERC20A"], CONTRACTS["TestERC20A"],
key=KEYS["validator"], key=KEYS["validator"],
) )
tx = erc20.functions.transfer(ADDRS["community"], 10).buildTransaction( tx = erc20.functions.transfer(ADDRS["community"], 10).build_transaction(
{"from": ADDRS["validator"]} {"from": ADDRS["validator"]}
) )
signed = sign_transaction(w3, tx, KEYS["validator"]) signed = sign_transaction(w3, tx, KEYS["validator"])
@ -49,6 +49,8 @@ def test_pruned_node(pruned):
tx_receipt = w3.eth.get_transaction_receipt(txhash.hex()) tx_receipt = w3.eth.get_transaction_receipt(txhash.hex())
assert len(tx_receipt.logs) == 1 assert len(tx_receipt.logs) == 1
data = "0x000000000000000000000000000000000000000000000000000000000000000a"
data = HexBytes(data)
expect_log = { expect_log = {
"address": erc20.address, "address": erc20.address,
"topics": [ "topics": [
@ -58,7 +60,7 @@ def test_pruned_node(pruned):
HexBytes(b"\x00" * 12 + HexBytes(ADDRS["validator"])), HexBytes(b"\x00" * 12 + HexBytes(ADDRS["validator"])),
HexBytes(b"\x00" * 12 + HexBytes(ADDRS["community"])), HexBytes(b"\x00" * 12 + HexBytes(ADDRS["community"])),
], ],
"data": "0x000000000000000000000000000000000000000000000000000000000000000a", "data": data,
"transactionIndex": 0, "transactionIndex": 0,
"logIndex": 0, "logIndex": 0,
"removed": False, "removed": False,
@ -111,9 +113,9 @@ def test_pruned_node(pruned):
"to": erc20.address, "to": erc20.address,
"transactionIndex": 0, "transactionIndex": 0,
"value": 0, "value": 0,
"type": "0x2", "type": 2,
"accessList": [], "accessList": [],
"chainId": "0x2328", "chainId": 9000,
} }
) )
assert tx1 == tx2 assert tx1 == tx2

View File

@ -127,7 +127,7 @@ def deploy_contract(w3, jsonfile, args=(), key=KEYS["validator"]):
acct = Account.from_key(key) acct = Account.from_key(key)
info = json.loads(jsonfile.read_text()) info = json.loads(jsonfile.read_text())
contract = w3.eth.contract(abi=info["abi"], bytecode=info["bytecode"]) contract = w3.eth.contract(abi=info["abi"], bytecode=info["bytecode"])
tx = contract.constructor(*args).buildTransaction({"from": acct.address}) tx = contract.constructor(*args).build_transaction({"from": acct.address})
txreceipt = send_transaction(w3, tx, key) txreceipt = send_transaction(w3, tx, key)
assert txreceipt.status == 1 assert txreceipt.status == 1
address = txreceipt.contractAddress address = txreceipt.contractAddress