|
1 |
| -# from pathlib import Path |
2 |
| -# from slither import Slither |
| 1 | +from pathlib import Path |
| 2 | +from slither import Slither |
3 | 3 |
|
4 |
| -# TEST_DATA_DIR = Path(__file__).resolve().parent / "test_data" |
| 4 | +TEST_DATA_DIR = Path(__file__).resolve().parent / "test_data" |
5 | 5 |
|
6 |
| -# ALL_TESTS = list(Path(TEST_DATA_DIR).glob("*.vy")) |
| 6 | +ALL_TESTS = list(Path(TEST_DATA_DIR).glob("*.vy")) |
7 | 7 |
|
8 | 8 |
|
9 |
| -# def pytest_generate_tests(metafunc): |
10 |
| -# test_cases = [] |
11 |
| -# for test_file in ALL_TESTS: |
12 |
| -# sl = Slither(test_file.as_posix()) |
13 |
| -# for contract in sl.contracts: |
14 |
| -# if contract.is_interface: |
15 |
| -# continue |
16 |
| -# for func_or_modifier in contract.functions: |
17 |
| -# test_cases.append( |
18 |
| -# (func_or_modifier.canonical_name, func_or_modifier.slithir_cfg_to_dot_str()) |
19 |
| -# ) |
| 9 | +def pytest_generate_tests(metafunc): |
| 10 | + test_cases = [] |
| 11 | + for test_file in ALL_TESTS: |
| 12 | + sl = Slither(test_file.as_posix()) |
| 13 | + for contract in sl.contracts: |
| 14 | + if contract.is_interface: |
| 15 | + continue |
| 16 | + for func_or_modifier in contract.functions: |
| 17 | + test_cases.append( |
| 18 | + (func_or_modifier.canonical_name, func_or_modifier.slithir_cfg_to_dot_str()) |
| 19 | + ) |
20 | 20 |
|
21 |
| -# metafunc.parametrize("test_case", test_cases, ids=lambda x: x[0]) |
| 21 | + metafunc.parametrize("test_case", test_cases, ids=lambda x: x[0]) |
22 | 22 |
|
23 | 23 |
|
24 |
| -# def test_vyper_cfgir(test_case, snapshot): |
25 |
| -# assert snapshot() == test_case[1] |
| 24 | +def test_vyper_cfgir(test_case, snapshot): |
| 25 | + assert snapshot() == test_case[1] |
0 commit comments