diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f38cb85..b01826b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: uses: actions/checkout@v4 with: path: DSIronPython - repository: DynamoDS/DSIronPython + ref: ${{ github.ref }} - name: Setup nuget uses: nuget/setup-nuget@v1.2 - name: Setup msbuild @@ -30,7 +30,7 @@ jobs: } - name: Run test with the dotnet CLI run: | - dotnet test ${{ github.workspace }}\DSIronPython --logger "trx;LogFileName=results.trx" --results-directory ${{ github.workspace }}\DSIronPython\TestResults + dotnet test ${{ github.workspace }}\DSIronPython -p:Configuration=Release --filter "TestCategory!=Failure" --logger "trx;LogFileName=results.trx" --results-directory ${{ github.workspace }}\DSIronPython\TestResults - name: Upload build artifact uses: actions/upload-artifact@v3.1.3 with: diff --git a/DSIronPython/DSIronPython.csproj b/DSIronPython/DSIronPython.csproj index cf73c07..958c830 100644 --- a/DSIronPython/DSIronPython.csproj +++ b/DSIronPython/DSIronPython.csproj @@ -4,20 +4,19 @@ $(SolutionDir)\package_output\DSIronPython\extra\ - {9EEF4F42-6B3B-4358-9A8A-C2701539A822} Library Properties DSIronPython DSIronPython - net6.0 - true + net8.0 + true - - + + runtime - all + @@ -30,6 +29,6 @@ - + \ No newline at end of file diff --git a/DSironPythonEmpty/DSIronPythonEmpty.csproj b/DSironPythonEmpty/DSIronPythonEmpty.csproj index 063c28e..9a8e11a 100644 --- a/DSironPythonEmpty/DSIronPythonEmpty.csproj +++ b/DSironPythonEmpty/DSIronPythonEmpty.csproj @@ -4,7 +4,7 @@ $(SolutionDir)\package_output\DSIronPython\bin\ - net6.0 + net8.0 enable enable diff --git a/IronPythonExtension/IronPythonExtension.csproj b/IronPythonExtension/IronPythonExtension.csproj index 41e7a85..b6d1122 100644 --- a/IronPythonExtension/IronPythonExtension.csproj +++ b/IronPythonExtension/IronPythonExtension.csproj @@ -4,18 +4,17 @@ $(SolutionDir)\package_output\DSIronPython\extra\ - {182FCA4E-B6EF-451F-9EC4-7BF2C622F4F7} Library Properties IronPythonExtension IronPythonExtension - net6.0 + net8.0 - + diff --git a/IronPythonTests/IronPythonTests.csproj b/IronPythonTests/IronPythonTests.csproj index a53615a..463ed40 100644 --- a/IronPythonTests/IronPythonTests.csproj +++ b/IronPythonTests/IronPythonTests.csproj @@ -1,38 +1,25 @@  - - - - 8.0.30703 - 2.0 - {E6DF2FBD-7D4D-4465-94DC-D576D737E985} - Library - Properties - IronPythonTests - IronPythonTests - net6.0-windows - true + net8.0 + true + false + - - - - - - + + - - ..\extern\DSCoreNodes.dll - - - ..\extern\FFITarget.dll - + + Always + - - - - \ No newline at end of file + + + + + + diff --git a/IronPythonTests/Setup.cs b/IronPythonTests/Setup.cs index 1a6caf7..e904405 100644 --- a/IronPythonTests/Setup.cs +++ b/IronPythonTests/Setup.cs @@ -1,37 +1,85 @@ using System; +using System.Collections.Generic; +using System.Configuration; +using System.Globalization; using System.IO; using System.Reflection; -using Dynamo.Utilities; using NUnit.Framework; -namespace IronPythonTests + +[SetUpFixture] +public class Setup { - [SetUpFixture] - public class Setup + private string moduleRootFolder; + List resolutionPaths; + + [OneTimeSetUp] + public void RunBeforeAllTests() { - private AssemblyHelper assemblyHelper; + var thisDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + var configPath = Path.Combine(thisDir, "TestServices.dll.config"); + + // Adjust the config file map because the config file + // might not always be in the same directory as the dll. + var map = new ExeConfigurationFileMap { ExeConfigFilename = configPath }; + var config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None); + + var element = config.AppSettings.Settings["DynamoBasePath"]; + moduleRootFolder = element?.Value ?? string.Empty; + + if (string.IsNullOrEmpty(moduleRootFolder)) + { + throw new Exception($"Missing DynamoBasePath in TestServices.dll.config. Please set the DynamoBasePath to a valid Dynamo bin folder. DynamoBasePath is set to {moduleRootFolder}"); + } + else if (!File.Exists(Path.Combine(moduleRootFolder, "DynamoCore.dll"))) + { + throw new Exception($"Invalid DynamoBasePath in TestServices.dll.config. Please set the DynamoBasePath to a valid Dynamo bin folder. DynamoBasePath is set to {moduleRootFolder}"); + } - [OneTimeSetUp] - public void RunBeforeAllTests() + resolutionPaths = new List { - var assemblyPath = Assembly.GetExecutingAssembly().Location; - var moduleRootFolder = Path.GetDirectoryName(assemblyPath); + // Search for nodes + Path.Combine(moduleRootFolder, "nodes"), + Path.Combine(moduleRootFolder, "en-us") + }; + AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; ; + } - var resolutionPaths = new[] + private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) + { + try + { + var targetAssemblyName = new AssemblyName(args.Name).Name + ".dll"; + + // First check the core path + string assemblyPath = Path.Combine(moduleRootFolder, targetAssemblyName); + if (File.Exists(assemblyPath)) { - // These tests need "CoreNodeModelsWpf.dll" under "nodes" folder. - Path.Combine(moduleRootFolder, "nodes") - }; + return Assembly.LoadFrom(assemblyPath); + } - assemblyHelper = new AssemblyHelper(moduleRootFolder, resolutionPaths); - AppDomain.CurrentDomain.AssemblyResolve += assemblyHelper.ResolveAssembly; - } + // Then check all additional resolution paths + foreach (var resolutionPath in resolutionPaths) + { + assemblyPath = Path.Combine(resolutionPath, targetAssemblyName); + if (File.Exists(assemblyPath)) + { + return Assembly.LoadFrom(assemblyPath); + } + } - [OneTimeTearDown] - public void RunAfterAllTests() + return null; + } + catch (Exception ex) { - AppDomain.CurrentDomain.AssemblyResolve -= assemblyHelper.ResolveAssembly; - assemblyHelper = null; + throw new Exception(string.Format("There location of the assembly, " + + "{0} could not be resolved for loading.", args.Name), ex); } } -} + + [OneTimeTearDown] + public void RunAfterAllTests() + { + AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve; + } +} \ No newline at end of file diff --git a/IronPythonTests/TestServices.dll.config b/IronPythonTests/TestServices.dll.config new file mode 100644 index 0000000..b9623ed --- /dev/null +++ b/IronPythonTests/TestServices.dll.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/extern/DSCoreNodes.dll b/extern/DSCoreNodes.dll deleted file mode 100644 index d286dd1..0000000 Binary files a/extern/DSCoreNodes.dll and /dev/null differ diff --git a/extern/FFITarget.dll b/extern/FFITarget.dll deleted file mode 100644 index 93efe02..0000000 Binary files a/extern/FFITarget.dll and /dev/null differ