]>
git.ipfire.org Git - thirdparty/psycopg.git/log
Daniele Varrazzo [Sat, 13 Nov 2021 17:01:28 +0000 (18:01 +0100)]
Silence test warnings on Python 3.6
Daniele Varrazzo [Sat, 13 Nov 2021 18:16:52 +0000 (19:16 +0100)]
Fix segfault using timezones on Python 3.6 in -Werror mode
Also fix a couple of attribute errors in less used code paths (in the
branches reporting errors when using unsupported datestyles).
Related: https://github.com/pganssle/zoneinfo/issues/109
Daniele Varrazzo [Sat, 13 Nov 2021 14:56:43 +0000 (15:56 +0100)]
Close all the resources during tests
This allows to run the test suite with -Werror.
Daniele Varrazzo [Sat, 13 Nov 2021 16:14:46 +0000 (17:14 +0100)]
Raise error on warnings in tests
Daniele Varrazzo [Sat, 13 Nov 2021 16:12:21 +0000 (17:12 +0100)]
Assume Python 3.10 available in the test runners
Daniele Varrazzo [Sat, 13 Nov 2021 14:05:19 +0000 (15:05 +0100)]
Drop string-bytes comparisons
They were mostly internal ones, coming from dicts containing strings and
bytes as keys.
Close #147
Daniele Varrazzo [Sat, 13 Nov 2021 15:02:46 +0000 (16:02 +0100)]
Enable error on str-bytes comparison in pytest
See #147
Daniele Varrazzo [Thu, 11 Nov 2021 21:49:34 +0000 (22:49 +0100)]
Shorter names in the build
This way we should be able to more of the grid parameters in the left
column of the Github build run page.
Daniele Varrazzo [Thu, 11 Nov 2021 20:02:09 +0000 (21:02 +0100)]
Bump to next dev release
Mikel Olasagasti Uranga [Wed, 10 Nov 2021 23:31:19 +0000 (00:31 +0100)]
Update dep on pytest-asyncio
Works fine with 0.16.0
See #143
Daniele Varrazzo [Wed, 10 Nov 2021 13:30:31 +0000 (14:30 +0100)]
Bump version numbers to release psycopg 3.0.3 and pool 3.0.1
Daniele Varrazzo [Wed, 10 Nov 2021 13:28:38 +0000 (14:28 +0100)]
Fix duplicate sentence in connection pool docs
Daniele Varrazzo [Wed, 10 Nov 2021 02:00:59 +0000 (03:00 +0100)]
Merge branch 'fix-144'
Daniele Varrazzo [Wed, 10 Nov 2021 01:22:20 +0000 (02:22 +0100)]
Add release notes file for the psycopg_pool package
Daniele Varrazzo [Wed, 10 Nov 2021 01:21:37 +0000 (02:21 +0100)]
Don't leave connections in transaction after pool.check()
Close #144.
Daniele Varrazzo [Wed, 10 Nov 2021 01:57:45 +0000 (02:57 +0100)]
Merge branch 'mypy-tests/all'
Denis Laxalde [Tue, 2 Nov 2021 10:58:00 +0000 (11:58 +0100)]
Let mypy check all tests/*
Per previous commits, the whole test suite should be clean.
Denis Laxalde [Fri, 5 Nov 2021 12:35:13 +0000 (13:35 +0100)]
Install test dependencies in 'mypy' tox env
We need this at least for tenacity.
Denis Laxalde [Fri, 5 Nov 2021 12:21:23 +0000 (13:21 +0100)]
Declare 'elapsed' value before usage in async connection tests
Resolves mypy error:
error: No binding for nonlocal "elapsed" found [misc]
Denis Laxalde [Fri, 5 Nov 2021 12:18:56 +0000 (13:18 +0100)]
Declare tx_params using TypeDict values in connection tests
This resolves a bunch of mypy errors because the second-level values of
tx_params are of heterogeneous types.
Denis Laxalde [Fri, 5 Nov 2021 12:10:19 +0000 (13:10 +0100)]
Ignore mypy 'attr-defined' error about asyncio.ProactorEventLoop in tests
Denis Laxalde [Fri, 5 Nov 2021 12:08:56 +0000 (13:08 +0100)]
Ignore mypy 'index' errors about cursor.fetchone() in connection tests
Denis Laxalde [Fri, 5 Nov 2021 12:05:20 +0000 (13:05 +0100)]
Add type variable to *Cursor in connection tests
Denis Laxalde [Fri, 5 Nov 2021 11:05:58 +0000 (12:05 +0100)]
Adjust types in test_connection*::test_row_factory()
We avoid using the same variable name for different types. At the end,
there seems to be something wrong, thus add a TODO for later.
Denis Laxalde [Fri, 5 Nov 2021 10:49:57 +0000 (11:49 +0100)]
Ignore mypy 'comparison-overlap' error about row_factory in tests
Denis Laxalde [Fri, 5 Nov 2021 10:47:10 +0000 (11:47 +0100)]
Catch explicit exception type in test_connect_badargs()
Work around the type of pytest.raises() which appears too strict.
Denis Laxalde [Fri, 5 Nov 2021 10:45:48 +0000 (11:45 +0100)]
Only declare type of 'the_conninfo' in test_connect_args()
Inform mypy that we're not passing a None to conninfo_to_dict().
Denis Laxalde [Fri, 5 Nov 2021 10:45:15 +0000 (11:45 +0100)]
Ignore mypy 'comparison-overlap' in connection tests
Denis Laxalde [Tue, 2 Nov 2021 10:16:53 +0000 (11:16 +0100)]
Let mypy ignore uvloop imports, missing types
Denis Laxalde [Tue, 2 Nov 2021 09:53:35 +0000 (10:53 +0100)]
Allow mypy implicit re-export for tenacity
Tenacity does not explicitly re-export names. Ignoring this fixes a
couple of mypy warning in tests/conftests.py.
Denis Laxalde [Fri, 5 Nov 2021 10:30:26 +0000 (11:30 +0100)]
Make test_concurrency*.py mypy-clean
Denis Laxalde [Fri, 5 Nov 2021 10:18:03 +0000 (11:18 +0100)]
Make test_copy*.py mypy-clean
Denis Laxalde [Tue, 2 Mar 2021 11:18:32 +0000 (12:18 +0100)]
Make cursor tests mypy-clean
Add a type annotation to 'rns' in test_rownumber(); assert that
cursor._query is not None.
Denis Laxalde [Fri, 5 Nov 2021 09:58:38 +0000 (10:58 +0100)]
Ignore 'arg-type' mypy error about list subclass in fix_db
Not sure why this is an error. Are we supposed to inherit from
List[Any]?
Denis Laxalde [Fri, 5 Nov 2021 09:51:33 +0000 (10:51 +0100)]
Make test_adapt.py mypy-clean
Declare dynamically filled variables; add assertions about value
returned by Transformer.get_dumper() when a ListDumper is expected
(because of 'sub_dumper' attribute only defined there); check None value
for optional attributes (e.g. sub_dumper); add '# type: ignore' as a
last resort.
Denis Laxalde [Fri, 5 Nov 2021 09:05:06 +0000 (10:05 +0100)]
Make fix_faker mypy-clean
Declare a couple of dynamically filled lists; add a type annotation for
the "key" function in sorted() call and defined the type of
get_supported_types; rename variables that change type; add '# type:
ignore' when it's not clear what to do.
Denis Laxalde [Fri, 5 Nov 2021 08:41:39 +0000 (09:41 +0100)]
Fix mypy errors in test_errors.py
Declare a couple a dynamic variables and check for None value before
checking optional properties' values.
Denis Laxalde [Fri, 5 Nov 2021 08:33:02 +0000 (09:33 +0100)]
Use a different iter variable in test_evict_lru_deallocate()
Resolves mypy error:
error: Incompatible types in assignment (expression has type "object", variable has type "int") [assignment]
And makes test_prepared*.py mypy clean.
Denis Laxalde [Fri, 5 Nov 2021 08:27:45 +0000 (09:27 +0100)]
Check that tzinfo.utcoffset() does not return None in conninfo tests
Avoids mypy error:
error: Item "None" of "Optional[timedelta]" has no attribute "total_seconds" [union-attr]
Now test_conninfo.py type checks.
Denis Laxalde [Tue, 2 Nov 2021 14:25:23 +0000 (15:25 +0100)]
Let mypy check tests/test_dns* code
We need to add dnspython to dev dependencies in order to get types for
the dns module when running mypy.
Denis Laxalde [Thu, 4 Nov 2021 15:04:38 +0000 (16:04 +0100)]
Do not catch TypeError in test_resolve_hostaddr_async_bad()
It appears that only psycopg.OperationalError is actually raised.
Denis Laxalde [Thu, 4 Nov 2021 14:59:37 +0000 (15:59 +0100)]
Add a type hint for a list in dns tests
Denis Laxalde [Fri, 5 Nov 2021 08:17:54 +0000 (09:17 +0100)]
Ignore (false) Mypy attr-defined error in dns tests
On test_dns*.py, Mypy raises:
error: Module has no attribute "resolve_hostaddr_async" [attr-defined]
error: Module has no attribute "resolve_srv" [attr-defined]
These are wrong since psycopg._dns actually has these names defined.
That's probably a mypy bug.
Denis Laxalde [Thu, 4 Nov 2021 14:58:50 +0000 (15:58 +0100)]
Add type parameter to AsyncConnection in dns tests
Daniele Varrazzo [Wed, 10 Nov 2021 00:42:26 +0000 (01:42 +0100)]
Docs typo: a -> an
Daniele Varrazzo [Wed, 10 Nov 2021 00:24:12 +0000 (01:24 +0100)]
Bump pool version number to next dev release
Daniele Varrazzo [Tue, 9 Nov 2021 23:37:22 +0000 (00:37 +0100)]
Merge branch 'musllinux'
Daniele Varrazzo [Tue, 9 Nov 2021 20:23:13 +0000 (21:23 +0100)]
Mention musllinux packages release in news file
Close #141.
Daniele Varrazzo [Tue, 9 Nov 2021 20:17:21 +0000 (21:17 +0100)]
Bump dev version numbers to prepare testpypi packages
Peter Lithammer [Mon, 8 Nov 2021 16:06:22 +0000 (17:06 +0100)]
Add Alpine support to `wheel_linux_before_all.sh` script
Peter Lithammer [Mon, 8 Nov 2021 14:24:03 +0000 (15:24 +0100)]
Update cibuildwheel to v2.2.2
The v2.2.x version of cibuildwheel adds supports for building
`musllinux`[^1] wheels. Meaning Alpine users can finally take advantage
of binary installations.
[^1]: https://www.python.org/dev/peps/pep-0656/
Daniele Varrazzo [Mon, 8 Nov 2021 21:28:02 +0000 (22:28 +0100)]
Expose the C package version in the _cmodule module
"Expose" just to say: this interface remains internal. But it's handy
for development and testing nonetheless.
Daniele Varrazzo [Mon, 8 Nov 2021 19:38:47 +0000 (20:38 +0100)]
Allow to run typing tests from an arbitrary location
Daniele Varrazzo [Mon, 8 Nov 2021 19:54:31 +0000 (20:54 +0100)]
Include typing information in psycopg-binary distribution
Daniele Varrazzo [Mon, 8 Nov 2021 20:09:58 +0000 (21:09 +0100)]
Merge branch 'wheel-strip' into packaging-love
Daniele Varrazzo [Mon, 8 Nov 2021 20:08:42 +0000 (21:08 +0100)]
Mention binary package size reduction in changelog
Daniele Varrazzo [Mon, 8 Nov 2021 18:33:23 +0000 (19:33 +0100)]
Install the zip command in the cibuildwheel image
Required to unpack the wheel archive and strip symbols.
Daniele Varrazzo [Mon, 8 Nov 2021 18:14:28 +0000 (19:14 +0100)]
Strip only psycopg dynamic libraries, not the system ones
Stripping symbols is beneficial (reduction of 30% of the final package, > %90%
of the installed libraries. However just running `auditwheel repair --strip`
breaks some of the libraries included from the system, which fail at import
with errors such as "ELF load command address/offset not properly aligned".
Daniele Varrazzo [Mon, 8 Nov 2021 16:55:54 +0000 (17:55 +0100)]
Strip debug symbols from wheel packages
Close #142
Daniele Varrazzo [Mon, 8 Nov 2021 18:55:06 +0000 (19:55 +0100)]
Bump to next dev release
Daniele Varrazzo [Mon, 8 Nov 2021 15:00:18 +0000 (16:00 +0100)]
Add Generic Counter and Deque to compat module
Daniele Varrazzo [Mon, 8 Nov 2021 14:03:45 +0000 (15:03 +0100)]
Set version number to 3.0.2
Daniele Varrazzo [Wed, 3 Nov 2021 15:56:12 +0000 (16:56 +0100)]
Merge branch 'mypy-tests/scripts'
Denis Laxalde [Tue, 2 Nov 2021 14:25:23 +0000 (15:25 +0100)]
Let mypy check tests/scripts code
Denis Laxalde [Tue, 2 Nov 2021 14:19:57 +0000 (15:19 +0100)]
Make spiketest.py script mypy-clean
- allow untyped defs/calls (as everywhere else in tests/*)
- avoid list comprehension filled with no value
- add a type variable to Connection subclass
- drop useless sys.exit() call, since main() does not return a value
Denis Laxalde [Tue, 2 Nov 2021 14:15:11 +0000 (15:15 +0100)]
Add a type hint for main() in dectest's scripts
Denis Laxalde [Tue, 2 Nov 2021 14:12:43 +0000 (15:12 +0100)]
Allow Iterable type for cursor.executemany() parameters
An iterable is enough since we only iterate over the parameters value
using a for loop (in _executemany_gen()).
There's an usage with a generator expression in
tests/scripts/dectest.py. (Spotted by running mypy.)
Daniele Varrazzo [Wed, 3 Nov 2021 15:55:26 +0000 (16:55 +0100)]
Merge branch 'mypy-tests/pool'
Denis Laxalde [Tue, 2 Nov 2021 12:11:19 +0000 (13:11 +0100)]
Let mypy check tests/pool code
Denis Laxalde [Tue, 2 Nov 2021 13:44:38 +0000 (14:44 +0100)]
Ignore mypy errors about cursor.fetchone()
fetchone() can return None, so mypy complains that '"None" object is
not iterable' (or not indexable).
Denis Laxalde [Tue, 2 Nov 2021 12:41:29 +0000 (13:41 +0100)]
Use the correct connection class in test_pool_async.py::test_putconn_no_pool()
Denis Laxalde [Tue, 2 Nov 2021 12:40:59 +0000 (13:40 +0100)]
Declare type variable for Counter in pool tests
We use the comment-style for type annotation because collections.Counter
is generic only since Python 3.9.
Denis Laxalde [Tue, 2 Nov 2021 12:40:27 +0000 (13:40 +0100)]
Declare types for dynamically populated lists in pool tests
Denis Laxalde [Tue, 2 Nov 2021 12:39:30 +0000 (13:39 +0100)]
Add required type variable to (Async)Connection in pool tests
Denis Laxalde [Tue, 2 Nov 2021 12:34:42 +0000 (13:34 +0100)]
Avoid unassigned list comprehensions in pool tests
Mypy complains that Thread.start()/join() does not return a value.
Denis Laxalde [Tue, 2 Nov 2021 12:14:12 +0000 (13:14 +0100)]
Use setattr() when monkeypatching in pool tests
This is to avoid mypy error: Cannot assign to a method.
Denis Laxalde [Tue, 2 Nov 2021 12:09:05 +0000 (13:09 +0100)]
Make tests/pool a Python package
Otherwise, per-module mypy configuration does not apply (and we, e.g.,
get error about "no-untyped-defs").
Daniele Varrazzo [Wed, 3 Nov 2021 15:54:50 +0000 (16:54 +0100)]
Merge branch 'mypy-tests/dbapi20'
Denis Laxalde [Tue, 2 Nov 2021 10:07:34 +0000 (11:07 +0100)]
Make dbapi20 tests mypy-clean
Denis Laxalde [Tue, 2 Nov 2021 10:44:23 +0000 (11:44 +0100)]
Catch only expected exception in test_psycopg_dbapi20.py::test_connect_args()
Denis Laxalde [Tue, 2 Nov 2021 10:05:05 +0000 (11:05 +0100)]
Drop duplicated test_nextset() method of DatabaseAPI20Test
Spotted by mypy:
error: Name "test_nextset" already defined on line 742
Daniele Varrazzo [Wed, 3 Nov 2021 15:54:06 +0000 (16:54 +0100)]
Merge branch 'mypy-tests/test_sql'
Denis Laxalde [Tue, 2 Nov 2021 10:32:46 +0000 (11:32 +0100)]
Let mypy check tests/test_sql.py
Denis Laxalde [Tue, 2 Nov 2021 10:30:00 +0000 (11:30 +0100)]
Fix type of re.sub() call in sql tests
All values of re.sub() must be of the type, here bytes.
Denis Laxalde [Tue, 2 Nov 2021 10:26:14 +0000 (11:26 +0100)]
Let mypy ignore expected type errors in sql tests
Denis Laxalde [Tue, 2 Nov 2021 10:24:30 +0000 (11:24 +0100)]
Work around a mypy 'Incompatible types in assignment' in sql tests
By defining 'obj' as a Composed value, we avoid the mypy error about
variable type change.
Daniele Varrazzo [Wed, 3 Nov 2021 15:53:16 +0000 (16:53 +0100)]
Merge branch 'mypy-tests/pq'
Denis Laxalde [Thu, 28 Oct 2021 09:35:04 +0000 (11:35 +0200)]
Let mypy check tests/pq code
Denis Laxalde [Tue, 2 Nov 2021 09:26:33 +0000 (10:26 +0100)]
Let mypy ignore an expected type error in pq tests
Denis Laxalde [Tue, 2 Nov 2021 09:26:22 +0000 (10:26 +0100)]
Adjust test_pgconn::test_info() for mypy
Resolves the following error:
error: Item "None" of "Optional[bytes]" has no attribute "decode"
Denis Laxalde [Tue, 2 Nov 2021 09:18:06 +0000 (10:18 +0100)]
Rename a variable in test_conninfo_parse()
To silent a 'incompatible types in assignment' mypy error.
Denis Laxalde [Tue, 2 Nov 2021 09:18:06 +0000 (10:18 +0100)]
Rename a variable in tests/pq/test_copy.py
To silent a 'incompatible types in assignment' mypy error.
Denis Laxalde [Tue, 2 Nov 2021 09:07:47 +0000 (10:07 +0100)]
Adjust test_pq::test_build_version() for mypy
pq.__build_version__ might be None.
Denis Laxalde [Tue, 2 Mar 2021 11:25:10 +0000 (12:25 +0100)]
Rename a variable in test_conninfo_parse() to silent a mypy error
Daniele Varrazzo [Wed, 3 Nov 2021 15:52:39 +0000 (16:52 +0100)]
Merge branch 'mypy-tests/types'
Denis Laxalde [Thu, 28 Oct 2021 09:35:04 +0000 (11:35 +0200)]
Let mypy check tests/types code
We configure mypy to check untyped defs in tests/ directory, but only
let it check tests/types files at the moment.
Denis Laxalde [Thu, 28 Oct 2021 08:42:49 +0000 (10:42 +0200)]
Rename a variable in test_composite.py::test_register_scope()
To make mypy happy.
Denis Laxalde [Thu, 28 Oct 2021 08:55:21 +0000 (10:55 +0200)]
Add a couple of "# type: ignore" in datetime tests
Mypy cannot check map() calls on split-strings.
Denis Laxalde [Thu, 28 Oct 2021 08:42:49 +0000 (10:42 +0200)]
Rename a variable in test_array.py::test_all_chars()
To make mypy happy.
Denis Laxalde [Thu, 28 Oct 2021 08:24:44 +0000 (10:24 +0200)]
Make test_multirange.py mypy-clean
Either ignoring errors (often intended) or adding type hints/ignore as
in previous commit.