Skip to content

Revise target timelines for roadmap features

0d2e3a5
Select commit
Loading
Failed to load commit list.
Open

DOC: Revise target timelines for roadmap features #510

Revise target timelines for roadmap features
0d2e3a5
Select commit
Loading
Failed to load commit list.
Azure Pipelines / MSSQL-Python-PR-Validation succeeded Apr 11, 2026 in 18m 12s

Build #pr-validation-pipeline had test failures

Details

Tests

  • Failed: 1 (0.00%)
  • Passed: 28,338 (97.25%)
  • Other: 799 (2.74%)
  • Total: 29,138
Code coverage

  • 6624 of 8386 lines covered (78.99%)

Annotations

Check failure on line 1 in test_cleanup_connections_scenarios[multiple_connections-\n class TestConnection:\n count = 0\n \n def __init__(self, conn_id):\n self.conn_id = conn_id\n self._closed = False\n self.close_called = False\n \n def close(self):\n self.close_called = True\n self._closed = True\n TestConnection.count += 1\n

See this annotation in the file changed.

@azure-pipelines azure-pipelines / MSSQL-Python-PR-Validation

test_cleanup_connections_scenarios[multiple_connections-\n class TestConnection:\n count = 0\n \n def __init__(self, conn_id):\n self.conn_id = conn_id\n self._closed = False\n self.close_called = False\n \n def close(self):\n self.close_called = True\n self._closed = True\n TestConnection.count += 1\n

AssertionError: Test failed. stderr: 
assert -11 == 0
 +  where -11 = CompletedProcess(args=['/opt/venv/bin/python', '-c', '\nimport mssql_python\n\n# Verify cleanup infrastructure exists\nassert hasattr(mssql_python, \'_active_connections\'), "Missing _active_connections"\nassert hasattr(mssql_python, \'_cleanup_connections\'), "Missing _cleanup_connections"\nassert hasattr(mssql_python, \'_register_connection\'), "Missing _register_connection"\n\n\nclass TestConnection:\n    count = 0\n\n    def __init__(self, conn_id):\n        self.conn_id = conn_id\n        self._closed = False\n        self.close_called = False\n\n    def close(self):\n        self.close_called = True\n        self._closed = True\n        TestConnection.count += 1\n\n# Register multiple connections\nconnections = [TestConnection(i) for i in range(5)]\nfor conn in connections:\n    mssql_python._register_connection(conn)\n\n# Cleanup all\nmssql_python._cleanup_connections()\n\nassert TestConnection.count == 5, f"All 5 connections should be closed, got {{TestConnection.count}}"\nassert all(c.close_called for c in connections), "All connections should have close() called"\n\n\nprint("Multiple connections: PASSED")\n'], returncode=-11, stdout='', stderr='').returncode
Raw output
self = <test_013_SqlHandle_free_shutdown.TestHandleFreeShutdown object at 0x5507d057d0>
conn_str = 'Server=172.17.0.4;Database=TestDB;Uid=SA;Pwd=Azure@123!;TrustServerCertificate=yes'
scenario = 'multiple_connections'
test_code = '\n            class TestConnection:\n                count = 0\n                \n                def __init__(self, ...       assert all(c.close_called for c in connections), "All connections should have close() called"\n                '
expected_msg = 'Multiple connections: PASSED'

    @pytest.mark.parametrize(
        "scenario,test_code,expected_msg",
        [
            (
                "normal_flow",
                """
            # Create mock connection to test registration and cleanup
            class MockConnection:
                def __init__(self):
                    self._closed = False
                    self.close_called = False
    
                def close(self):
                    self.close_called = True
                    self._closed = True
    
            # Register connection
            mock_conn = MockConnection()
            mssql_python._register_connection(mock_conn)
            assert mock_conn in mssql_python._active_connections, "Connection not registered"
    
            # Test cleanup
            mssql_python._cleanup_connections()
            assert mock_conn.close_called, "close() should have been called"
            assert mock_conn._closed, "Connection should be marked as closed"
                """,
                "Normal flow: PASSED",
            ),
            (
                "already_closed",
                """
            class MockConnection:
                def __init__(self):
                    self._closed = True  # Already closed
                    self.close_called = False
    
                def close(self):
                    self.close_called = True
                    raise AssertionError("close() should not be called on closed connection")
    
            # Register already-closed connection
            mock_conn = MockConnection()
            mssql_python._register_connection(mock_conn)
    
            # Cleanup should skip this connection
            mssql_python._cleanup_connections()
            assert not mock_conn.close_called, "close() should NOT have been called"
                """,
                "Already closed: PASSED",
            ),
            (
                "missing_attribute",
                """
            class MinimalConnection:
                # No _closed attribute
                def close(self):
                    pass
    
            # Register connection without _closed
            mock_conn = MinimalConnection()
            mssql_python._register_connection(mock_conn)
    
            # Should not crash
            mssql_python._cleanup_connections()
                """,
                "Missing attribute: PASSED",
            ),
            (
                "exception_handling",
                """
            class GoodConnection:
                def __init__(self):
                    self._closed = False
                    self.close_called = False
    
                def close(self):
                    self.close_called = True
                    self._closed = True
    
            class BadConnection:
                def __init__(self):
                    self._closed = False
    
                def close(self):
                    raise RuntimeError("Simulated error during close")
    
            # Register both good and bad connections
            good_conn = GoodConnection()
            bad_conn = BadConnection()
            mssql_python._register_connection(bad_conn)
            mssql_python._register_connection(good_conn)
    
            # Cleanup should handle exception and continue
            try:
                mssql_python._cleanup_connections()
                # Should not raise despite bad_conn throwing exception
                assert good_conn.close_called, "G