diff --git a/docs/middleware.rst b/docs/middleware.rst index bd21088d13..42dc7aa76e 100644 --- a/docs/middleware.rst +++ b/docs/middleware.rst @@ -389,7 +389,7 @@ The easiest way to connect to a default ``geth --dev`` instance which loads the >>> from web3.auto.gethdev import w3 # confirm that the connection succeeded - >>> w3.clientVersion + >>> w3.client_version 'Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9' This example connects to a local ``geth --dev`` instance on Linux with a @@ -408,7 +408,7 @@ unique IPC location and loads the middleware: >>> w3.middleware_onion.inject(geth_poa_middleware, layer=0) # confirm that the connection succeeded - >>> w3.clientVersion + >>> w3.client_version 'Geth/v1.7.3-stable-4bb3c89d/linux-amd64/go1.9' Why is ``geth_poa_middleware`` necessary? diff --git a/docs/providers.rst b/docs/providers.rst index 280f2cc18d..d18fc19d63 100644 --- a/docs/providers.rst +++ b/docs/providers.rst @@ -134,10 +134,10 @@ For example, the following retrieves the client enode endpoint for both geth and connected = w3.is_connected() - if connected and w3.clientVersion.startswith('Parity'): + if connected and w3.client_version.startswith('Parity'): enode = w3.parity.enode - elif connected and w3.clientVersion.startswith('Geth'): + elif connected and w3.client_version.startswith('Geth'): enode = w3.geth.admin.node_info['enode'] else: diff --git a/docs/web3.main.rst b/docs/web3.main.rst index 48a0951d9b..1161977336 100644 --- a/docs/web3.main.rst +++ b/docs/web3.main.rst @@ -37,7 +37,7 @@ Attributes >>> web3.api "4.7.0" -.. py:attribute:: Web3.clientVersion +.. py:attribute:: Web3.client_version * Delegates to ``web3_clientVersion`` RPC Method @@ -45,7 +45,7 @@ Attributes .. code-block:: python - >>> web3.clientVersion + >>> web3.client_version 'Geth/v1.4.11-stable-fed692f6/darwin/go1.7' diff --git a/newsfragments/2686.breaking.rst b/newsfragments/2686.breaking.rst new file mode 100644 index 0000000000..587fc5001f --- /dev/null +++ b/newsfragments/2686.breaking.rst @@ -0,0 +1 @@ +Snakecase the clientVersion method \ No newline at end of file diff --git a/tests/core/version-module/test_version_module.py b/tests/core/version-module/test_version_module.py index 96afec5d67..096a6d53b5 100644 --- a/tests/core/version-module/test_version_module.py +++ b/tests/core/version-module/test_version_module.py @@ -55,4 +55,4 @@ def test_legacy_version_deprecation(blocking_w3): async def test_async_blocking_version(async_w3, blocking_w3): assert async_w3.async_version.api == blocking_w3.api - assert await async_w3.async_version.node == blocking_w3.clientVersion + assert await async_w3.async_version.node == blocking_w3.client_version diff --git a/tests/core/web3-module/test_clientVersion.py b/tests/core/web3-module/test_clientVersion.py deleted file mode 100644 index 2d117b1af2..0000000000 --- a/tests/core/web3-module/test_clientVersion.py +++ /dev/null @@ -1,2 +0,0 @@ -def test_web3_clientVersion(w3): - assert w3.clientVersion.startswith("EthereumTester/") diff --git a/tests/core/web3-module/test_client_version.py b/tests/core/web3-module/test_client_version.py new file mode 100644 index 0000000000..a1f95a3cd5 --- /dev/null +++ b/tests/core/web3-module/test_client_version.py @@ -0,0 +1,2 @@ +def test_web3_client_version(w3): + assert w3.client_version.startswith("EthereumTester/") diff --git a/tests/integration/go_ethereum/common.py b/tests/integration/go_ethereum/common.py index 7df6450315..add85859c7 100644 --- a/tests/integration/go_ethereum/common.py +++ b/tests/integration/go_ethereum/common.py @@ -29,7 +29,7 @@ class GoEthereumTest(Web3ModuleTest): - def _check_web3_clientVersion(self, client_version): + def _check_web3_client_version(self, client_version): assert client_version.startswith("Geth/") diff --git a/tests/integration/test_ethereum_tester.py b/tests/integration/test_ethereum_tester.py index 1fa79b7bc0..d3bd54874e 100644 --- a/tests/integration/test_ethereum_tester.py +++ b/tests/integration/test_ethereum_tester.py @@ -251,7 +251,7 @@ def funded_account_for_raw_txn(w3): class TestEthereumTesterWeb3Module(Web3ModuleTest): - def _check_web3_clientVersion(self, client_version): + def _check_web3_client_version(self, client_version): assert client_version.startswith("EthereumTester/") diff --git a/web3/_utils/module_testing/web3_module.py b/web3/_utils/module_testing/web3_module.py index 1e4a1469eb..936b41a191 100644 --- a/web3/_utils/module_testing/web3_module.py +++ b/web3/_utils/module_testing/web3_module.py @@ -25,11 +25,11 @@ class Web3ModuleTest: - def test_web3_clientVersion(self, w3: Web3) -> None: - client_version = w3.clientVersion - self._check_web3_clientVersion(client_version) + def test_web3_client_version(self, w3: Web3) -> None: + client_version = w3.client_version + self._check_web3_client_version(client_version) - def _check_web3_clientVersion(self, client_version: str) -> NoReturn: + def _check_web3_client_version(self, client_version: str) -> NoReturn: raise NotImplementedError("Must be implemented by subclasses") # Contract that calculated test values can be found at diff --git a/web3/main.py b/web3/main.py index 915e79f32b..99fb34360f 100644 --- a/web3/main.py +++ b/web3/main.py @@ -274,7 +274,7 @@ def provider(self, provider: Union[BaseProvider, AsyncBaseProvider]) -> None: self.manager.provider = provider @property - def clientVersion(self) -> str: + def client_version(self) -> str: return self.manager.request_blocking(RPC.web3_clientVersion, []) @property diff --git a/web3/version.py b/web3/version.py index 758470039b..1874700485 100644 --- a/web3/version.py +++ b/web3/version.py @@ -60,7 +60,8 @@ def api(self) -> NoReturn: @property def node(self) -> NoReturn: raise DeprecationWarning( - "This method has been deprecated ... Please use web3.clientVersion instead." + "This method has been deprecated ... " + "Please use web3.client_version instead." ) @property