diff --git a/.flake8 b/.flake8 index b9934d04..ae5a762d 100644 --- a/.flake8 +++ b/.flake8 @@ -1,3 +1,3 @@ [flake8] -ignore = B008,B306,E203,E402,E731,D100,D101,D102,D103,D104,D105,W503,W504,E252,F999,F541 +ignore = B008,B023,B306,E203,E402,E731,D100,D101,D102,D103,D104,D105,W503,W504,E252,F999,F541 exclude = .git,__pycache__,build,dist,.eggs diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5dfe6041..28cb0d53 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] edgedb-version: [stable , nightly] os: [ubuntu-latest, macos-latest, windows-2019] loop: [asyncio, uvloop] diff --git a/edgedb/abstract.py b/edgedb/abstract.py index ba9a3f6c..7e8f4f6a 100644 --- a/edgedb/abstract.py +++ b/edgedb/abstract.py @@ -131,6 +131,7 @@ def _get_query_cache(self) -> QueryCache: def _get_retry_options(self) -> typing.Optional[options.RetryOptions]: return None + @abc.abstractmethod def _get_state(self) -> options.State: ... diff --git a/edgedb/blocking_client.py b/edgedb/blocking_client.py index aafccab8..97931501 100644 --- a/edgedb/blocking_client.py +++ b/edgedb/blocking_client.py @@ -102,10 +102,9 @@ async def connect_addr(self, addr, timeout): self._addr = addr self._ping_wait_time = max( ( - getattr( - self.get_settings().get("system_config"), - "session_idle_timeout", - ) + self.get_settings() + .get("system_config") + .session_idle_timeout - DEFAULT_PING_BEFORE_IDLE_TIMEOUT ), MINIMUM_PING_WAIT_TIME, diff --git a/edgedb/color.py b/edgedb/color.py index 1e95c7bf..2b972aaa 100644 --- a/edgedb/color.py +++ b/edgedb/color.py @@ -55,6 +55,7 @@ def get_color() -> Color: except KeyError: warnings.warn( "EDGEDB_COLOR_OUTPUT can only be one of: " - "default, auto, enabled or disabled" + "default, auto, enabled or disabled", + stacklevel=1, ) USE_COLOR = False diff --git a/edgedb/con_utils.py b/edgedb/con_utils.py index fa939502..c359a056 100644 --- a/edgedb/con_utils.py +++ b/edgedb/con_utils.py @@ -641,7 +641,7 @@ def _parse_connect_dsn_and_args( ): # EDGEDB_PORT is set by 'docker --link' so ignore and warn warnings.warn('EDGEDB_PORT in "tcp://host:port" format, ' + - 'so will be ignored') + 'so will be ignored', stacklevel=1) env_port = None env_dsn = os.getenv('EDGEDB_DSN') diff --git a/edgedb/errors/_base.py b/edgedb/errors/_base.py index cd1d7f79..11f5c26d 100644 --- a/edgedb/errors/_base.py +++ b/edgedb/errors/_base.py @@ -331,7 +331,8 @@ def _unicode_width(text): ] except KeyError: warnings.warn( - "EDGEDB_ERROR_HINT can only be one of: default, enabled or disabled" + "EDGEDB_ERROR_HINT can only be one of: default, enabled or disabled", + stacklevel=1, ) SHOW_HINT = False diff --git a/setup.py b/setup.py index 8884fed2..c5d0ebbb 100644 --- a/setup.py +++ b/setup.py @@ -45,10 +45,10 @@ # pycodestyle is a dependency of flake8, but it must be frozen because # their combination breaks too often # (example breakage: https://gitlab.com/pycqa/flake8/issues/427) - 'pycodestyle~=2.6.0', - 'pyflakes~=2.2.0', - 'flake8-bugbear~=21.4.3', - 'flake8~=3.8.1', + 'pycodestyle~=2.11.1', + 'pyflakes~=3.2.0', + 'flake8-bugbear~=24.4.26', + 'flake8~=7.0.0', 'uvloop>=0.15.1; platform_system != "Windows"', ] diff --git a/tests/datatypes/test_datatypes.py b/tests/datatypes/test_datatypes.py index 93bbcd17..3cedc705 100644 --- a/tests/datatypes/test_datatypes.py +++ b/tests/datatypes/test_datatypes.py @@ -60,7 +60,7 @@ def test_recorddesc_1(self): private._RecordDescriptor(('a', 'b')) - with self.assertRaisesRegex(ValueError, f'more than {0x4000-1}'): + with self.assertRaisesRegex(ValueError, f'more than {0x4000 - 1}'): private._RecordDescriptor(('a',) * 20000) def test_recorddesc_2(self): diff --git a/tests/test_async_query.py b/tests/test_async_query.py index 39b2dd7b..0720dc1d 100644 --- a/tests/test_async_query.py +++ b/tests/test_async_query.py @@ -87,7 +87,7 @@ async def test_async_parse_error_recover_02(self): await self.client.execute('select syntax error') for _ in range(10): - await self.client.execute('select 1; select 2;'), + await self.client.execute('select 1; select 2;') async def test_async_exec_error_recover_01(self): for _ in range(2): diff --git a/tests/test_asyncio_client.py b/tests/test_asyncio_client.py index 13e7c843..b4d5b03d 100644 --- a/tests/test_asyncio_client.py +++ b/tests/test_asyncio_client.py @@ -442,9 +442,9 @@ async def cb(r: asyncio.StreamReader, w: asyncio.StreamWriter): try: await self._test_connection_broken(client, broken) finally: + await asyncio.wait_for(client.aclose(), 5) server.close() await server.wait_closed() - await asyncio.wait_for(client.aclose(), 5) broken.set() await done.wait() diff --git a/tests/test_blocking_client.py b/tests/test_blocking_client.py index 396356b5..099baa71 100644 --- a/tests/test_blocking_client.py +++ b/tests/test_blocking_client.py @@ -453,9 +453,9 @@ async def cb(r: asyncio.StreamReader, w: asyncio.StreamWriter): None, self._test_connection_broken, client, broken ) finally: + await self.loop.run_in_executor(None, client.close, 5) server.close() await server.wait_closed() - await self.loop.run_in_executor(None, client.close, 5) broken.set() await done.wait() diff --git a/tests/test_sync_query.py b/tests/test_sync_query.py index 79dae829..2b03797e 100644 --- a/tests/test_sync_query.py +++ b/tests/test_sync_query.py @@ -75,7 +75,7 @@ def test_sync_parse_error_recover_02(self): self.client.execute('select syntax error') for _ in range(10): - self.client.execute('select 1; select 2;'), + self.client.execute('select 1; select 2;') def test_sync_exec_error_recover_01(self): for _ in range(2):