pywin32 icon indicating copy to clipboard operation
pywin32 copied to clipboard

Full adodbapi type-check and test fixes

Open Avasam opened this issue 1 month ago • 0 comments

Overlaps with https://github.com/mhammond/pywin32/pull/2286, merging that first will reduce changes here.


I wanted to see how far I could get running the adodbapi tests (for https://github.com/mhammond/pywin32/pull/1495) but found them in a poor and broken state (especially on Python 3.13+)

Lots of those issues can be caught with static type-checking, so I enabled the full pyright standard checks and started fixing.

  • Added a few assert where code should fail anyway, to help static type checkers. This would also result in clearer errors in unittests
  • Added a few attributes type declaration (often that are meant to be set by subclasses implementing an abstract class)
  • Updated __getattr__ that can actually be implemented as properties
  • Fixed test detection by using loadTestsFromTestCase rather than loadTestsFromModule
  • Added a missing mdb_name param to setuptestframework.makemdb in adodbapi/test/test_adodbapi_dbapi20.py
  • Ensure this is all tested on CI
  • Fixed standalone adodbapi install (pip install ./adodbapi)
  • Some comments were better as docstrings
  • Fixed a few typos

I've managed to run all SQL Server tests locally using SQL Express. So these would be the following steps (which I'll offload to another PR(s)) to be able to run adodbapi/test/test_adodbapi_dbapi20.py on the CI:

  • It should be easy to install MSSQL Server with https://github.com/potatoqualitee/mssqlsuite .
  • I need to figure out how to install the OLEDB driver https://learn.microsoft.com/en-us/sql/connect/oledb/download-oledb-driver-for-sql-server
  • Haven't looked at postgress on GitHub actions, but it is now so popular I assume it shouldn't be too complicated either.
  • I have no idea about an Access Database yet (but apparently it's working out of the box on GitHub actions 32-bit)
  • Then to also test all these on Linux

Avasam avatar Nov 25 '25 04:11 Avasam