Skip to content

SQL Server driver test makes unwarranted assumption #1000

@bkline

Description

@bkline

Environment

  • Python: 3.10
  • pyodbc: 4.0.32
  • OS: macOS 11.6.2
  • DB: SQL Server Microsoft SQL Server 2019 (RTM-CU14) (KB5007182) - 15.0.4188.2 (X64) Developer Edition (64-bit) on Linux (Ubuntu 20.04.3 LTS)
  • driver: freetds stable 1.3.6

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions