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; };
};
})
(_: pkgs: { test-env = import ./testenv.nix { inherit pkgs; }; })
(_: pkgs: { test-env = pkgs.callPackage ./testenv.nix { }; })
(_: pkgs: {
cosmovisor = pkgs.buildGo118Module rec {
name = "cosmovisor";

View File

@ -41,10 +41,10 @@
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f904e3562aabca382d12f8471ca2330b3f82899a",
"sha256": "1lsa3sjwp1v3nv2jjpkl5lf9dncplwihmavasalg9fq1217pmzmb",
"rev": "ea2c6a6dda1aa35a80139a512a9dee375b0946e7",
"sha256": "0nd4nn9ryqa80ssw3j2kmr8wa73p2xz1hyxp280cdzqlmdfgw1lm",
"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"
}
}

View File

@ -1,18 +1,38 @@
{ pkgs }:
pkgs.poetry2nix.mkPoetryEnv {
{ poetry2nix, lib, python310 }:
poetry2nix.mkPoetryEnv {
projectDir = ../tests/integration_tests;
python = pkgs.python39;
overrides = pkgs.poetry2nix.overrides.withDefaults (self: super: {
python = python310;
overrides = poetry2nix.overrides.withDefaults (lib.composeManyExtensions [
(self: super:
let
buildSystems = {
eth-bloom = [ "setuptools" ];
pystarport = [ "poetry" ];
durations = [ "setuptools" ];
multitail2 = [ "setuptools" ];
pytest-github-actions-annotate-failures = [ "setuptools" ];
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\' ""
'';
};
pystarport = super.pystarport.overridePythonAttrs (
old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.poetry ];
}
);
});
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]
python = "^3.8"
pytest = "^7.0.1"
pytest = "7.1.1"
pytest-github-actions-annotate-failures = "^0.1.1"
flake8 = "^4.0.1"
black = "^22.3.0"
flake8-black = "^0.3.2"
flake8-isort = "^4.1.1"
pep8-naming = "^0.11.1"
protobuf = "^3.20.2"
protobuf = "^3.13.0"
grpcio = "^1.33.2"
PyYAML = "^5.3.1"
python-dateutil = "^2.8.1"
web3 = "^5.20.1"
web3 = "^6.0.0b6"
eth-bloom = "^1.0.4"
python-dotenv = "^0.19.2"
pystarport = { git = "https://github.com/crypto-com/pystarport.git", branch = "main" }
websockets = "^9.1"
websockets = "^10.3"
toml = "^0.10.2"
pysha3 = "^1.0.2"
jsonnet = "^0.18.0"

View File

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

View File

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

View File

@ -127,7 +127,7 @@ def deploy_contract(w3, jsonfile, args=(), key=KEYS["validator"]):
acct = Account.from_key(key)
info = json.loads(jsonfile.read_text())
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)
assert txreceipt.status == 1
address = txreceipt.contractAddress