Skip to content

Commit 26966d3

Browse files
author
dse
committed
Added embed_tests project to VS 2017 build. All tests are passed for net40 build.
1 parent 7fe824c commit 26966d3

File tree

6 files changed

+101
-4
lines changed

6 files changed

+101
-4
lines changed

pythonnet.15.sln

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,46 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26228.9
4+
VisualStudioVersion = 15.0.26228.10
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.Runtime.15", "src\runtime\Python.Runtime.15.csproj", "{4D2089E1-5B6A-4799-984B-178AE467902D}"
77
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.EmbeddingTest.15", "src\embed_tests\Python.EmbeddingTest.15.csproj", "{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|x64 = Debug|x64
1013
Debug-Linux-x64|x64 = Debug-Linux-x64|x64
1114
Debug-Win-x64|x64 = Debug-Win-x64|x64
15+
Release|x64 = Release|x64
1216
Release-Linux-x64|x64 = Release-Linux-x64|x64
1317
Release-Win-x64|x64 = Release-Win-x64|x64
1418
EndGlobalSection
1519
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20+
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug|x64.ActiveCfg = Debug|x64
21+
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug|x64.Build.0 = Debug|x64
1622
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug-Linux-x64|x64.ActiveCfg = Release|x64
1723
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug-Linux-x64|x64.Build.0 = Debug|x64
1824
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug-Win-x64|x64.ActiveCfg = Debug-Win-x64|x64
1925
{4D2089E1-5B6A-4799-984B-178AE467902D}.Debug-Win-x64|x64.Build.0 = Debug-Win-x64|x64
26+
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release|x64.ActiveCfg = Release|x64
27+
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release|x64.Build.0 = Release|x64
2028
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release-Linux-x64|x64.ActiveCfg = Release|x64
2129
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release-Linux-x64|x64.Build.0 = Release|x64
2230
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release-Win-x64|x64.ActiveCfg = Release|x64
2331
{4D2089E1-5B6A-4799-984B-178AE467902D}.Release-Win-x64|x64.Build.0 = Release|x64
32+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug|x64.ActiveCfg = Debug|Any CPU
33+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug|x64.Build.0 = Debug|Any CPU
34+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug-Linux-x64|x64.ActiveCfg = Debug|Any CPU
35+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug-Linux-x64|x64.Build.0 = Debug|Any CPU
36+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug-Win-x64|x64.ActiveCfg = Debug|x64
37+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Debug-Win-x64|x64.Build.0 = Debug|x64
38+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release|x64.ActiveCfg = Release|Any CPU
39+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release|x64.Build.0 = Release|Any CPU
40+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release-Linux-x64|x64.ActiveCfg = Release|Any CPU
41+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release-Linux-x64|x64.Build.0 = Release|Any CPU
42+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release-Win-x64|x64.ActiveCfg = Release|Any CPU
43+
{4CACAA81-CC6A-4381-85B8-3A4B57EFE3BD}.Release-Win-x64|x64.Build.0 = Release|Any CPU
2444
EndGlobalSection
2545
GlobalSection(SolutionProperties) = preSolution
2646
HideSolutionNode = FALSE
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFrameworks>net40;netstandard1.6</TargetFrameworks>
4+
<!--<PackageTargetFallback>net</PackageTarg0etFallback>-->
5+
<RootNamespace>Python.EmbeddingTest</RootNamespace>
6+
<AssemblyName>Python.EmbeddingTest</AssemblyName>
7+
<PackageId>Python.EmbeddingTest</PackageId>
8+
<VersionPrefix>3.0.0</VersionPrefix>
9+
<VersionSuffix>Alpha</VersionSuffix>
10+
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
11+
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
12+
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
13+
<!--<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>-->
14+
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
15+
<DebugType>Full</DebugType>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Platform)' == 'x86'">
18+
<PlatformTarget>x86</PlatformTarget>
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Platform)' == 'x64'">
21+
<PlatformTarget>x64</PlatformTarget>
22+
</PropertyGroup>
23+
24+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net40|x64'" />
25+
26+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net40|x64'" />
27+
28+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard1.6|x64'" />
29+
30+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard1.6|x64'" />
31+
32+
<PropertyGroup>
33+
<DefineConstants>$(DefineConstants);XPLAT</DefineConstants>
34+
</PropertyGroup>
35+
36+
<ItemGroup>
37+
<PackageReference Include="NUnit">
38+
<Version>3.6.1</Version>
39+
</PackageReference>
40+
</ItemGroup>
41+
42+
<ItemGroup>
43+
<ProjectReference Include="..\runtime\Python.Runtime.15.csproj" />
44+
</ItemGroup>
45+
<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
46+
<Reference Include="Microsoft.CSharp" />
47+
</ItemGroup>
48+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.6'">
49+
<PackageReference Include="Microsoft.CSharp">
50+
<Version>4.0.1</Version>
51+
</PackageReference>
52+
</ItemGroup>
53+
<ItemGroup>
54+
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
55+
</ItemGroup>
56+
<ItemGroup>
57+
<None Update="fixtures\**\*.py">
58+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
59+
</None>
60+
</ItemGroup>
61+
</Project>

src/embed_tests/TestRuntime.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using NUnit.Framework;
33
using Python.Runtime;
44

src/embed_tests/pyimport.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.IO;
33
using NUnit.Framework;
44
using Python.Runtime;
@@ -30,7 +30,11 @@ public void SetUp()
3030
/* Append the tests directory to sys.path
3131
* using reflection to circumvent the private
3232
* modifiers placed on most Runtime methods. */
33+
#if XPLAT
34+
const string s = "fixtures";
35+
#else
3336
const string s = "../fixtures";
37+
#endif
3438
string testPath = Path.Combine(TestContext.CurrentContext.TestDirectory, s);
3539

3640
IntPtr str = Runtime.Runtime.PyString_FromString(testPath);

src/runtime/Python.Runtime.15.csproj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</PropertyGroup>
3535

3636
<PropertyGroup>
37-
<DefineConstants>$(DefineConstants);REFLECTIONBRIDGE;PYTHON3;PYTHON35</DefineConstants>
37+
<DefineConstants>$(DefineConstants);XPLAT;REFLECTIONBRIDGE;PYTHON3;PYTHON35</DefineConstants>
3838
</PropertyGroup>
3939

4040
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.5'">
@@ -69,4 +69,12 @@
6969
<Version>4.0.0</Version>
7070
</PackageReference>
7171
</ItemGroup>
72+
73+
<ItemGroup>
74+
<None Remove="resources\clr.py" />
75+
</ItemGroup>
76+
77+
<ItemGroup>
78+
<EmbeddedResource Include="resources\clr.py" />
79+
</ItemGroup>
7280
</Project>

src/runtime/pythonengine.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true)
198198
#else
199199
Assembly assembly = Assembly.GetExecutingAssembly();
200200
#endif
201+
#if XPLAT
202+
using (Stream stream = assembly.GetManifestResourceStream("Python.Runtime.resources.clr.py"))
203+
#else
201204
using (Stream stream = assembly.GetManifestResourceStream("clr.py"))
205+
#endif
202206
using (var reader = new StreamReader(stream))
203207
{
204208
// add the contents of clr.py to the module

0 commit comments

Comments
 (0)