Skip to content

Commit d906a14

Browse files
authored
style(tools): convert absolute to relative imports across codebase (#1907)
Convert absolute imports to relative imports within the same package Changes affect: * CLI components (eest, eofwrap) * Test files across all packages * Pytest plugin components (consume, execute, filler) * Framework utility modules
1 parent fd34ad0 commit d906a14

File tree

18 files changed

+31
-23
lines changed

18 files changed

+31
-23
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Users can select any of the artifacts depending on their testing needs for their
9090
### 📋 Misc
9191

9292
- 🔀 Use only relative imports in `tests/` directory ([#1848](https://github.com/ethereum/execution-spec-tests/pull/1848)).
93+
- 🔀 Convert absolute imports to relative imports in `src/` directory for better code maintainability ([#1907](https://github.com/ethereum/execution-spec-tests/pull/1907)).
9394
- 🔀 Misc. doc updates, including a navigation footer ([#1846](https://github.com/ethereum/execution-spec-tests/pull/1846)).
9495
- 🔀 Remove Python 3.10 support ([#1808](https://github.com/ethereum/execution-spec-tests/pull/1808)).
9596
- 🔀 Modernize codebase with Python 3.11 language features ([#1812](https://github.com/ethereum/execution-spec-tests/pull/1812)).

src/cli/eest/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import click
77

8-
from cli.eest.commands import clean, info
9-
from cli.eest.make.cli import make
8+
from .commands import clean, info
9+
from .make.cli import make
1010

1111

1212
@click.group(context_settings={"help_option_names": ["-h", "--help"], "max_content_width": 120})

src/cli/eest/make/cli.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
import click
1212

13-
from cli.eest.make.commands import create_default_env
14-
15-
from .commands import test
13+
from .commands import create_default_env, test
1614

1715

1816
@click.group(short_help="Generate project files.")

src/cli/eest/make/commands/env.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
import click
44
from jinja2 import Environment, PackageLoader
55

6-
from cli.eest.quotes import get_quote
76
from config.env import ENV_PATH, Config
87

8+
from ...quotes import get_quote
9+
910

1011
@click.command(short_help="Generate the default environment file (env.yaml).", name="env")
1112
def create_default_env():

src/cli/eest/make/commands/test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
import click
1414
import jinja2
1515

16-
from cli.input import input_select, input_text
1716
from config.docs import DocsConfig
1817
from ethereum_test_forks import get_development_forks, get_forks
1918

19+
from ....input import input_select, input_text
20+
2021
template_loader = jinja2.PackageLoader("cli.eest.make")
2122
template_env = jinja2.Environment(
2223
loader=template_loader, keep_trailing_newline=True, trim_blocks=True, lstrip_blocks=True

src/cli/eofwrap.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import click
2121

22-
from cli.evm_bytes import OpcodeWithOperands, process_evm_bytes
2322
from ethereum_clis import CLINotFoundInPathError
2423
from ethereum_clis.clis.evmone import EvmOneTransitionTool
2524
from ethereum_test_base_types import Bytes, EthereumTestRootModel
@@ -36,6 +35,8 @@
3635
from ethereum_test_types.eof.v1 import Container
3736
from ethereum_test_vm.bytecode import Bytecode
3837

38+
from .evm_bytes import OpcodeWithOperands, process_evm_bytes
39+
3940

4041
@click.command()
4142
@click.argument("input_path", type=click.Path(exists=True, dir_okay=True, file_okay=True))

src/cli/gentest/tests/test_cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
import pytest
44
from click.testing import CliRunner
55

6-
from cli.gentest.cli import generate
7-
from cli.gentest.test_context_providers import StateTestProvider
86
from ethereum_test_base_types import Account
97
from ethereum_test_tools import Environment, Storage, Transaction
108

9+
from ..cli import generate
10+
from ..test_context_providers import StateTestProvider
11+
1112
transactions_by_type = {
1213
0: {
1314
"environment": Environment(

src/pytest_plugins/consume/simulators/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
from ethereum_test_fixtures.consume import TestCaseIndexFile, TestCaseStream
1313
from ethereum_test_fixtures.file import Fixtures
1414
from ethereum_test_rpc import EthRPC
15-
from pytest_plugins.consume.consume import FixturesSource
15+
16+
from ..consume import FixturesSource
1617

1718

1819
@pytest.fixture(scope="function")

src/pytest_plugins/consume/simulators/simulator_logic/test_via_engine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
from ethereum_test_fixtures import BlockchainEngineFixture
1212
from ethereum_test_rpc import EngineRPC, EthRPC
1313
from ethereum_test_rpc.types import ForkchoiceState, JSONRPCError, PayloadStatusEnum
14-
from pytest_plugins.consume.simulators.helpers.exceptions import GenesisBlockMismatchExceptionError
15-
from pytest_plugins.logging import get_logger
1614

15+
from ....logging import get_logger
16+
from ..helpers.exceptions import GenesisBlockMismatchExceptionError
1717
from ..helpers.timing import TimingData
1818

1919
logger = get_logger(__name__)

src/pytest_plugins/consume/simulators/simulator_logic/test_via_rlp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
from ethereum_test_fixtures import BlockchainFixture
1111
from ethereum_test_rpc import EthRPC
12-
from pytest_plugins.consume.simulators.helpers.exceptions import GenesisBlockMismatchExceptionError
1312

13+
from ..helpers.exceptions import GenesisBlockMismatchExceptionError
1414
from ..helpers.timing import TimingData
1515

1616
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)