Skip to content

fix(devcontainer): improve shell aliases and connection string setup

33f3611
Select commit
Loading
Failed to load commit list.
Merged

CHORE: Create devcontainer for repo #147

fix(devcontainer): improve shell aliases and connection string setup
33f3611
Select commit
Loading
Failed to load commit list.
Azure Pipelines / MSSQL-Python-PR-Validation succeeded Feb 4, 2026 in 16m 52s

Build #pr-validation-pipeline had test failures

Details

Tests

  • Failed: 1 (0.00%)
  • Passed: 24,843 (97.13%)
  • Other: 734 (2.87%)
  • Total: 25,578
Code coverage

  • 5458 of 7121 lines covered (76.65%)

Annotations

Check failure on line 1 in test_no_segfault_on_gc

See this annotation in the file changed.

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

test_no_segfault_on_gc

AssertionError: Expected no segfault, but got: 
assert -11 == 0
 +  where -11 = CompletedProcess(args=['/opt/venv/bin/python', '-c', '\nfrom mssql_python import connect\nconn = connect("Server=172.17.0.4;Database=TestDB;Uid=SA;Pwd=Azure@123!;TrustServerCertificate=yes")\ncursors = [conn.cursor() for _ in range(5)]\nfor cur in cursors:\n    cur.execute("SELECT 1")\n    cur.fetchall()\ndel conn\nimport gc; gc.collect()\ndel cursors\ngc.collect()\n    '], returncode=-11, stdout='', stderr='').returncode
Raw output
conn_str = 'Server=172.17.0.4;Database=TestDB;Uid=SA;Pwd=Azure@123!;TrustServerCertificate=yes'

    def test_no_segfault_on_gc(conn_str):
        """Test that no segmentation fault occurs during garbage collection"""
        # Properly escape the connection string for embedding in code
        escaped_conn_str = conn_str.replace("\\", "\\\\").replace('"', '\\"')
        code = f"""
    from mssql_python import connect
    conn = connect("{escaped_conn_str}")
    cursors = [conn.cursor() for _ in range(5)]
    for cur in cursors:
        cur.execute("SELECT 1")
        cur.fetchall()
    del conn
    import gc; gc.collect()
    del cursors
    gc.collect()
        """
        # Run the code in a subprocess to avoid segfaults in the main process
        # This is a workaround to test for segfaults in Python, as they can crash the interpreter
        # and pytest does not handle segfaults gracefully.
        # Note: This is a simplified example; in practice, you might want to use a more robust method
        # to handle subprocesses and capture their output/errors.
        result = subprocess.run([sys.executable, "-c", code], capture_output=True, text=True)
>       assert result.returncode == 0, f"Expected no segfault, but got: {result.stderr}"
E       AssertionError: Expected no segfault, but got: 
E       assert -11 == 0
E        +  where -11 = CompletedProcess(args=['/opt/venv/bin/python', '-c', '\nfrom mssql_python import connect\nconn = connect("Server=172.17.0.4;Database=TestDB;Uid=SA;Pwd=Azure@123!;TrustServerCertificate=yes")\ncursors = [conn.cursor() for _ in range(5)]\nfor cur in cursors:\n    cur.execute("SELECT 1")\n    cur.fetchall()\ndel conn\nimport gc; gc.collect()\ndel cursors\ngc.collect()\n    '], returncode=-11, stdout='', stderr='').returncode

tests/test_005_connection_cursor_lifecycle.py:105: AssertionError