Skip to content

Commit eedbae5

Browse files
committed
Merge remote-tracking branch 'upstream/master' into domain-reload-test-cases-fixes
2 parents 62ae107 + 9f01ebb commit eedbae5

23 files changed

+846
-47
lines changed

.github/workflows/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ jobs:
4949
- name: Python Tests
5050
run: pytest
5151

52-
- name: Run Embedding tests
52+
- name: Embedding tests
5353
run: dotnet test --runtime any-${{ matrix.platform }} src/embed_tests/
5454
if: ${{ matrix.os != 'macos' }} # Not working right now, doesn't find libpython
5555

56+
- name: Python tests run from .NET
57+
run: dotnet test --runtime any-${{ matrix.platform }} src/python_tests_runner/
58+
if: ${{ matrix.os == 'windows' }} # Not working for others right now
59+
5660
# TODO: Run perf tests
5761
# TODO: Run mono tests on Windows?

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- Benoît Hudson ([@benoithudson](https://github.com/benoithudson))
2525
- Bradley Friedman ([@leith-bartrich](https://github.com/leith-bartrich))
2626
- Callum Noble ([@callumnoble](https://github.com/callumnoble))
27+
- Christabella Irwanto([@christabella](https://github.com/christabella))
2728
- Christian Heimes ([@tiran](https://github.com/tiran))
2829
- Christoph Gohlke ([@cgohlke](https://github.com/cgohlke))
2930
- Christopher Bremner ([@chrisjbremner](https://github.com/chrisjbremner))

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This document follows the conventions laid out in [Keep a CHANGELOG][].
1010
### Added
1111

1212
- Ability to instantiate new .NET arrays using `Array[T](dim1, dim2, ...)` syntax
13+
- Python operator method will call C# operator method for supported binary and unary operators ([#1324][p1324]).
1314

1415
### Changed
1516
- Drop support for Python 2, 3.4, and 3.5
@@ -44,6 +45,7 @@ details about the cause of the failure
4445
- Made it possible to call `ToString`, `GetHashCode`, and `GetType` on inteface objects
4546
- Fixed objects returned by enumerating `PyObject` being disposed too soon
4647
- Incorrectly using a non-generic type with type parameters now produces a helpful Python error instead of throwing NullReferenceException
48+
- `import` may now raise errors with more detail than "No module named X"
4749

4850
### Removed
4951

pythonnet.sln

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{BC426F42
4949
tools\geninterop\geninterop.py = tools\geninterop\geninterop.py
5050
EndProjectSection
5151
EndProject
52+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Python.PythonTestsRunner", "src\python_tests_runner\Python.PythonTestsRunner.csproj", "{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}"
53+
EndProject
5254
Global
5355
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5456
Debug|Any CPU = Debug|Any CPU
@@ -143,6 +145,30 @@ Global
143145
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Release|x64.Build.0 = Release|Any CPU
144146
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Release|x86.ActiveCfg = Release|Any CPU
145147
{F2FB6DA3-318E-4F30-9A1F-932C667E38C5}.Release|x86.Build.0 = Release|Any CPU
148+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
149+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Debug|Any CPU.Build.0 = Debug|Any CPU
150+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Debug|x64.ActiveCfg = Debug|Any CPU
151+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Debug|x64.Build.0 = Debug|Any CPU
152+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Debug|x86.ActiveCfg = Debug|Any CPU
153+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Debug|x86.Build.0 = Debug|Any CPU
154+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Release|Any CPU.ActiveCfg = Release|Any CPU
155+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Release|Any CPU.Build.0 = Release|Any CPU
156+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Release|x64.ActiveCfg = Release|Any CPU
157+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Release|x64.Build.0 = Release|Any CPU
158+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Release|x86.ActiveCfg = Release|Any CPU
159+
{6CF9EEA0-F865-4536-AABA-739AE3DA971E}.Release|x86.Build.0 = Release|Any CPU
160+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
161+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Debug|Any CPU.Build.0 = Debug|Any CPU
162+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Debug|x64.ActiveCfg = Debug|Any CPU
163+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Debug|x64.Build.0 = Debug|Any CPU
164+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Debug|x86.ActiveCfg = Debug|Any CPU
165+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Debug|x86.Build.0 = Debug|Any CPU
166+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Release|Any CPU.ActiveCfg = Release|Any CPU
167+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Release|Any CPU.Build.0 = Release|Any CPU
168+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Release|x64.ActiveCfg = Release|Any CPU
169+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Release|x64.Build.0 = Release|Any CPU
170+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Release|x86.ActiveCfg = Release|Any CPU
171+
{35CBBDEB-FC07-4D04-9D3E-F88FC180110B}.Release|x86.Build.0 = Release|Any CPU
146172
EndGlobalSection
147173
GlobalSection(SolutionProperties) = preSolution
148174
HideSolutionNode = FALSE

src/embed_tests/Python.EmbeddingTest.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
<None Include="fixtures/**/*.py" CopyToOutputDirectory="PreserveNewest" />
1313
</ItemGroup>
1414

15+
<PropertyGroup>
16+
<DefineConstants>$(DefineConstants);$(ConfiguredConstants)</DefineConstants>
17+
</PropertyGroup>
18+
1519
<ItemGroup>
1620
<PackageReference Include="NUnit" Version="3.*" />
1721
<PackageReference Include="NUnit3TestAdapter" Version="3.*">
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Reflection;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
using NUnit.Framework;
9+
10+
using Python.Runtime;
11+
12+
namespace Python.EmbeddingPythonTest
13+
{
14+
public class TestNativeTypeOffset
15+
{
16+
private Py.GILState _gs;
17+
18+
[SetUp]
19+
public void SetUp()
20+
{
21+
_gs = Py.GIL();
22+
}
23+
24+
[TearDown]
25+
public void Dispose()
26+
{
27+
_gs.Dispose();
28+
}
29+
30+
/// <summary>
31+
/// Tests that installation has generated code for NativeTypeOffset and that it can be loaded.
32+
/// </summary>
33+
[Test]
34+
public void LoadNativeTypeOffsetClass()
35+
{
36+
PyObject sys = Py.Import("sys");
37+
string attributeName = "abiflags";
38+
if (sys.HasAttr(attributeName) && !string.IsNullOrEmpty(sys.GetAttr(attributeName).ToString()))
39+
{
40+
string typeName = "Python.Runtime.NativeTypeOffset, Python.Runtime";
41+
Assert.NotNull(Type.GetType(typeName), $"{typeName} does not exist and sys.{attributeName} is not empty");
42+
}
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)