Skip to content

Commit 694a938

Browse files
committed
Add tests
1 parent ea8a717 commit 694a938

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<IsPackable>false</IsPackable>
5+
<IsTestProject>true</IsTestProject>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="coverlet.collector" Version="6.0.0" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
11+
<PackageReference Include="NUnit" Version="3.14.0" />
12+
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
13+
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
14+
15+
<PackageReference Include="DynamoVisualProgramming.Core" Version="$(DynamoPackageVersion)">
16+
<ExcludeAssets>runtime</ExcludeAssets>
17+
<IncludeAssets>compile; build; native; contentfiles; analyzers</IncludeAssets>
18+
</PackageReference>
19+
<PackageReference Include="DynamoVisualProgramming.Tests" Version="$(DynamoPackageVersion)">
20+
<ExcludeAssets>runtime</ExcludeAssets>
21+
<IncludeAssets>compile; build; native; contentfiles; analyzers</IncludeAssets>
22+
</PackageReference>
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<ProjectReference Include="..\DSPythonNet3\DSPythonNet3.csproj" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<Using Include="NUnit.Framework" />
31+
</ItemGroup>
32+
33+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using Dynamo;
2+
using System.Collections;
3+
4+
namespace DSPythonNet3
5+
{
6+
public class PythonLibraryTests : DynamoModelTestBase
7+
{
8+
protected override void GetLibrariesToPreload(List<string> libraries)
9+
{
10+
libraries.Add("DSCoreNodes.dll");
11+
}
12+
13+
[Test]
14+
public void TestSciPyAvailable()
15+
{
16+
string code = @"
17+
from scipy import special
18+
19+
OUT = special.exp10(3)
20+
";
21+
var empty = new ArrayList();
22+
var result = DSPythonNet3Evaluator.EvaluatePythonScript(code, empty, empty);
23+
Assert.That(result, Is.EqualTo(1000));
24+
}
25+
}
26+
}

DynamoPythonNet3.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1919
EndProject
2020
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DSPythonNet3Wheels", "DSPythonNet3Wheels\DSPythonNet3Wheels.csproj", "{DC900437-51C9-42F3-BA35-9165B56E40FD}"
2121
EndProject
22+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DSPythonNet3Tests", "DSpythonNet3Tests\DSPythonNet3Tests.csproj", "{08CBABF4-E13F-4C89-AAB4-95A07510EA33}"
23+
EndProject
2224
Global
2325
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2426
Debug|Any CPU = Debug|Any CPU
@@ -41,6 +43,10 @@ Global
4143
{DC900437-51C9-42F3-BA35-9165B56E40FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
4244
{DC900437-51C9-42F3-BA35-9165B56E40FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
4345
{DC900437-51C9-42F3-BA35-9165B56E40FD}.Release|Any CPU.Build.0 = Release|Any CPU
46+
{08CBABF4-E13F-4C89-AAB4-95A07510EA33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47+
{08CBABF4-E13F-4C89-AAB4-95A07510EA33}.Debug|Any CPU.Build.0 = Debug|Any CPU
48+
{08CBABF4-E13F-4C89-AAB4-95A07510EA33}.Release|Any CPU.ActiveCfg = Release|Any CPU
49+
{08CBABF4-E13F-4C89-AAB4-95A07510EA33}.Release|Any CPU.Build.0 = Release|Any CPU
4450
EndGlobalSection
4551
GlobalSection(SolutionProperties) = preSolution
4652
HideSolutionNode = FALSE

pipeline.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ build:
1919
-
2020
scripts:
2121
- dotnet msbuild DynamoPythonNet3.sln -p:Configuration=Release -restore
22+
23+
ci_test:
24+
tests:
25+
-
26+
scripts:
27+
- dotnet test
2228

2329
deployment:
2430
-

0 commit comments

Comments
 (0)