You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ee...@apache.org on 2023/04/11 18:48:10 UTC

[arrow] branch main updated: GH-34988: [C#] Fix Windows-specific test issue in CDataSchemaPythonTest (#34989)

This is an automated email from the ASF dual-hosted git repository.

eerhardt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 776ea3f4f3 GH-34988: [C#] Fix Windows-specific test issue in CDataSchemaPythonTest (#34989)
776ea3f4f3 is described below

commit 776ea3f4f3d665f38fc370d0f284760eafa7de45
Author: Curt Hagenlocher <cu...@hagenlocher.org>
AuthorDate: Tue Apr 11 11:48:00 2023 -0700

    GH-34988: [C#] Fix Windows-specific test issue in CDataSchemaPythonTest (#34989)
    
    ### Rationale for this change
    
    Fixes issue described in referenced bug.
    
    ### What changes are included in this PR?
    
    Changes test initialization under Windows to add a references to the "DLLs" subdirectory containing _socket.pyd.
    
    ### Are these changes tested?
    
    Covered by existing tests.
    
    ### Are there any user-facing changes?
    
    No.
    * Closes: #34988
    
    Authored-by: Curt Hagenlocher <cu...@hagenlocher.org>
    Signed-off-by: Eric Erhardt <er...@microsoft.com>
---
 csharp/src/Apache.Arrow/C/CArrowSchemaExporter.cs           | 2 +-
 csharp/test/Apache.Arrow.Tests/CDataInterfacePythonTests.cs | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/csharp/src/Apache.Arrow/C/CArrowSchemaExporter.cs b/csharp/src/Apache.Arrow/C/CArrowSchemaExporter.cs
index 5c517f4185..75fb5fb957 100644
--- a/csharp/src/Apache.Arrow/C/CArrowSchemaExporter.cs
+++ b/csharp/src/Apache.Arrow/C/CArrowSchemaExporter.cs
@@ -275,4 +275,4 @@ namespace Apache.Arrow.C
             schema->release = null;
         }
     }
-}
\ No newline at end of file
+}
diff --git a/csharp/test/Apache.Arrow.Tests/CDataInterfacePythonTests.cs b/csharp/test/Apache.Arrow.Tests/CDataInterfacePythonTests.cs
index 82e0f37dd7..7f7fa83a8a 100644
--- a/csharp/test/Apache.Arrow.Tests/CDataInterfacePythonTests.cs
+++ b/csharp/test/Apache.Arrow.Tests/CDataInterfacePythonTests.cs
@@ -15,7 +15,9 @@
 
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
+using System.Runtime.InteropServices;
 using Apache.Arrow.C;
 using Apache.Arrow.Types;
 using Python.Runtime;
@@ -33,6 +35,13 @@ namespace Apache.Arrow.Tests
             Skip.If(!pythonSet && !inCIJob, "PYTHONNET_PYDLL not set; skipping C Data Interface tests.");
 
             PythonEngine.Initialize();
+
+            if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
+                !PythonEngine.PythonPath.Contains("dlls", StringComparison.OrdinalIgnoreCase))
+            {
+                dynamic sys = Py.Import("sys");
+                sys.path.append(Path.Combine(Path.GetDirectoryName(Environment.GetEnvironmentVariable("PYTHONNET_PYDLL")), "DLLs"));
+            }
         }
 
         private static Schema GetTestSchema()