Skip to content

Commit 8aa3a18

Browse files
committed
move transaction tests to json_infra
1 parent 3482325 commit 8aa3a18

File tree

11 files changed

+107
-513
lines changed

11 files changed

+107
-513
lines changed

tests/berlin/test_transaction.py

Lines changed: 0 additions & 57 deletions
This file was deleted.

tests/byzantium/test_transaction.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

tests/constantinople/test_transaction.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

tests/frontier/test_transaction.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

tests/homestead/test_transaction.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

tests/istanbul/test_transaction.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

tests/helpers/fork_types_helpers.py renamed to tests/json_infra/helpers/load_transaction_tests.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
from ethereum.utils.hexadecimal import hex_to_bytes
66

77

8+
class NoTestsFound(Exception):
9+
"""
10+
An exception thrown when the test for a particular fork isn't
11+
available in the json fixture
12+
"""
13+
14+
815
def load_test_transaction(
916
test_dir: str, test_file: str, network: str
1017
) -> Dict[str, Any]:
@@ -16,7 +23,9 @@ def load_test_transaction(
1623
json_data = json.load(fp)[f"{test_name}"]
1724

1825
tx_rlp = hex_to_bytes(json_data["txbytes"])
19-
20-
test_result = json_data["result"][network]
26+
try:
27+
test_result = json_data["result"][network]
28+
except KeyError:
29+
raise NoTestsFound(f"No tests found for {network} in {test_file}")
2130

2231
return {"tx_rlp": tx_rlp, "test_result": test_result}

0 commit comments

Comments
 (0)