mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.92k stars 563 forks source link

SQL Server driver test makes unwarranted assumption #1000

Closed bkline closed 2 years ago

bkline commented 2 years ago

Environment

Issue

The test_drivers() method in tests3/sqlservertests.py assumes that the regular expression DRIVER={?([^}]+?)}?; will always find a match in the output of pyodbc.drivers(). That assumption causes the test to fail when (for example) the output of pyodbc.drivers() is ['FreeTDS', 'PostgreSQL', 'SQLite'].

======================================================================
ERROR: test_drivers (__main__.SqlServerTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/bkline/repos/pyodbc/tests3/sqlservertests.py", line 1659, in test_drivers
    current = m.group(1)
AttributeError: 'NoneType' object has no attribute 'group'
gordthompson commented 2 years ago

That test is looking for a DRIVER= argument in the connection string. Are you using a DSN= connection string when you run your tests?

bkline commented 2 years ago

Correct.