Skip to content

Commit

Permalink
Merge branch 'main' into 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
slozier committed Dec 24, 2024
2 parents 9d3e6f6 + 819bccb commit f610b3d
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 87 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v4
with:
dotnet-version: '3.1.x'
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v4
with:
Expand All @@ -31,6 +27,10 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Setup .NET 9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Version Information
run: |
dotnet --info
Expand All @@ -48,9 +48,6 @@ jobs:
- name: Test (net462)
run: ./make.ps1 -frameworks net462 test-all
shell: pwsh
- name: Test (netcoreapp3.1)
run: ./make.ps1 -frameworks netcoreapp3.1 test-all
shell: pwsh
- name: Test (net6.0)
run: ./make.ps1 -frameworks net6.0 test-all
shell: pwsh
Expand Down
38 changes: 0 additions & 38 deletions Build/netcoreapp3.1.props

This file was deleted.

12 changes: 6 additions & 6 deletions Build/steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ steps:
displayName: Grab Package Version
- task: UseDotNet@2
displayName: Install .NET Core 3.1 runtime for testing
displayName: Install .NET 6.0 runtime for testing
inputs:
packageType: 'runtime'
version: '3.1.x'
version: '6.0.x'

- task: UseDotNet@2
displayName: Install .NET 6.0 runtime for testing
displayName: Install .NET 8.0 runtime for testing
inputs:
packageType: 'runtime'
version: '6.0.x'
version: '8.0.x'

- task: UseDotNet@2
displayName: Install .NET 8.0 SDK for build
displayName: Install .NET 9.0 SDK for build
inputs:
packageType: 'sdk'
version: '8.0.x'
version: '9.0.x'

# Set Mono version on macOS
- ${{ if eq(parameters.os, 'macOS') }}:
Expand Down
1 change: 0 additions & 1 deletion IronPython.sln
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{17737ACB
Build\net8.0.props = Build\net8.0.props
Build\net9.0-windows.props = Build\net9.0-windows.props
Build\net9.0.props = Build\net9.0.props
Build\netcoreapp3.1.props = Build\netcoreapp3.1.props
Build\netstandard2.0.props = Build\netstandard2.0.props
Build\steps.yml = Build\steps.yml
Build\Tasks.Targets = Build\Tasks.Targets
Expand Down
10 changes: 3 additions & 7 deletions Package/nuget/IronPython.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,16 @@ This package contains the IronPython interpreter engine.</description>
<dependency id="Microsoft.Win32.Registry" version="4.7.0" />
<dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" />
</group>
<group targetFramework="net6.0">
<dependency id="DynamicLanguageRuntime" version="1.3.5" />
<dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" />
</group>
<group targetFramework="net8.0">
<dependency id="DynamicLanguageRuntime" version="1.3.5" />
<dependency id="Mono.Unix" version="7.1.0-final.1.21458.1" />
</group>
</dependencies>
</metadata>
<files>
<file src="**\IronPython*.dll" target="lib" exclude="**\IronPythonTest.dll;**\DLLs\*.dll;netcoreapp3.1\**\*;net9.0*\**\*" />
<file src="**\IronPython*.pdb" target="lib" exclude="**\IronPythonTest.pdb;**\DLLs\*.pdb;netcoreapp3.1\**\*;net9.0*\**\*" />
<file src="**\IronPython*.xml" target="lib" exclude="**\IronPythonTest.xml;**\DLLs\*.xml;netcoreapp3.1\**\*;net9.0*\**\*" />
<file src="**\IronPython*.dll" target="lib" exclude="**\IronPythonTest.dll;**\DLLs\*.dll;net6.0\**\*;net9.0*\**\*" />
<file src="**\IronPython*.pdb" target="lib" exclude="**\IronPythonTest.pdb;**\DLLs\*.pdb;net6.0\**\*;net9.0*\**\*" />
<file src="**\IronPython*.xml" target="lib" exclude="**\IronPythonTest.xml;**\DLLs\*.xml;net6.0\**\*;net9.0*\**\*" />
<file src="LICENSE" />
<file src="..\..\..\nuget\README.md" target="" />
<file src="..\..\..\..\Documentation\logo.png" target="" />
Expand Down
2 changes: 1 addition & 1 deletion Package/zip/Zip.Packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<MakeDir Directories="$(PackageDir)" Condition="!Exists('$(PackageDir)')"/>

<ItemGroup>
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\README.md;$(StageDir)\**\*.pdb;$(StageDir)\netstandard2.0\**\*;$(StageDir)\netcoreapp3.1\**\*;$(StageDir)\net9.0*\**\*" />
<ZipFiles Include="$(StageDir)\**\*.*" Exclude="$(StageDir)\README.md;$(StageDir)\**\*.pdb;$(StageDir)\netstandard2.0\**\*;$(StageDir)\net6.0\**\*;$(StageDir)\net9.0*\**\*" />
<ZipFiles Include="README.md" Link="$(MSBuildThisFileDirectory)README.md" />
<ZipFiles Include="scripts/Enter-IronPythonEnvironment.ps1" Link="$(RootDir)Src\Scripts\Enter-IronPythonEnvironment.ps1" />
<ZipFiles Include="scripts/Install-IronPython.ps1" Link="$(RootDir)Src\Scripts\Install-IronPython.ps1" />
Expand Down
10 changes: 1 addition & 9 deletions Src/IronPythonConsole/IronPythonConsole.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netcoreapp3.1;net6.0;net8.0</TargetFrameworks>
<!-- EOL netcoreapp3.1 is used to test netstandard2.0 assemblies -->
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<TargetFrameworks>net462;net6.0;net8.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>IronPythonConsole</RootNamespace>
<AssemblyName>ipy</AssemblyName>
Expand All @@ -20,12 +18,6 @@
<OutputItemType>Content</OutputItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</ProjectReference>
<!-- add reference so it gets copied to the netcoreapp3.1 folder for testing -->
<ProjectReference Include="..\IronPython.SQLite\IronPython.SQLite.csproj" Condition="$(TargetFramework) == 'netcoreapp3.1'">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Content</OutputItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</ProjectReference>
</ItemGroup>

<ItemGroup Condition=" '$(IsFullFramework)' == 'true' AND !$([MSBuild]::IsOSPlatform('WINDOWS')) ">
Expand Down
4 changes: 1 addition & 3 deletions Src/IronPythonTest/IronPythonTest.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netcoreapp3.1;net6.0;net8.0</TargetFrameworks>
<!-- EOL netcoreapp3.1 is used to test netstandard2.0 assemblies -->
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<TargetFrameworks>net462;net6.0;net8.0</TargetFrameworks>
<PreventStaging>true</PreventStaging>
</PropertyGroup>

Expand Down
20 changes: 11 additions & 9 deletions Tests/modules/network_related/test__socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import time
import unittest

from iptest import IronPythonTestCase, is_cli, is_osx, is_linux, is_windows, is_cpython, run_test
from iptest import IronPythonTestCase, is_cli, is_mono, is_osx, is_linux, is_windows, is_cpython, run_test

AF_DICT = {"AF_APPLETALK" : 5,
"AF_DECnet" : 12,
Expand Down Expand Up @@ -432,7 +432,6 @@ def test_cp5814(self):
HOST = 'localhost'
PORT = 0
s = _socket.socket(_socket.AF_INET, _socket.SOCK_STREAM)
s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, 1) # prevents an "Address already in use" error when the socket is in a TIME_WAIT state
s.settimeout(20) # prevents the server from staying open if the client never connects
s.bind((HOST, PORT))
s.listen(1)
Expand Down Expand Up @@ -534,15 +533,14 @@ def test_misc(self):
def test_makefile_refcount(self):
"Ensures that the _socket stays open while there's still a file associated"

GPORT = None
PORT = None
def echoer():
nonlocal GPORT
nonlocal PORT
s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # prevents an "Address already in use" error when the socket is in a TIME_WAIT state
s.settimeout(15) # prevents the server from staying open if the client never connects
s.bind(('localhost', 0))
GPORT = s.getsockname()[1]
s.listen(5)
PORT = s.getsockname()[1]
(s2, _) = s.accept()
s2.send(s2.recv(10))
s2.close()
Expand All @@ -551,11 +549,16 @@ def echoer():
_thread.start_new_thread(echoer, ())
for _ in range(20):
time.sleep(0.5)
if GPORT is not None:
if PORT is not None:
break

if is_mono:
# Warm up Mono to connecting sockets
dummy = socket.socket()
s = socket.socket()
s.connect(('localhost', GPORT))
if is_mono:
dummy.close()
s.connect(('localhost', PORT))
f1 = s.makefile('r')
f2 = s.makefile('w')
s.close()
Expand All @@ -582,7 +585,6 @@ def test_cp7451(self):
HOST = 'localhost'
PORT = 0
s = _socket.socket(_socket.AF_INET, _socket.SOCK_STREAM)
s.setsockopt(_socket.SOL_SOCKET, _socket.SO_REUSEADDR, 1) # prevents an "Address already in use" error when the socket is in a TIME_WAIT state
s.settimeout(20) # prevents the server from staying open if the client never connects
s.bind((HOST, PORT))
s.listen(1)
Expand Down
5 changes: 4 additions & 1 deletion Tests/modules/type_related/test_ctypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import gc
import unittest

from iptest import IronPythonTestCase, is_posix, is_cli, big, myint, run_test
from iptest import IronPythonTestCase, is_posix, is_cli, is_mono, big, myint, run_test

class CTypesTest(IronPythonTestCase):
export_error_msg = "Existing exports of data: object cannot be re-sized" if is_cli else "cannot resize an array that is exporting buffers"
Expand All @@ -30,11 +30,14 @@ def test_from_array(self):
self.assertRaisesMessage(BufferError, self.export_error_msg, arr.append, 100)
self.assertRaisesMessage(BufferError, self.export_error_msg, arr.insert, 10, 100)

if is_mono:
with c: pass # gc.collect() in Mono may return before collection is finished
del c
gc.collect()
arr.append(100)
self.assertEqual(arr[-1], 100)

@unittest.skipIf(is_mono, "gc.collect() in Mono may return before collection is finished")
def test_from_memoryview(self):
arr = array('i', range(16))
with memoryview(arr) as mv:
Expand Down
10 changes: 9 additions & 1 deletion Tests/test_descr_stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Run selected tests from test_descr from StdLib
##

from iptest import is_ironpython, generate_suite, run_test
from iptest import is_ironpython, is_mono, generate_suite, run_test

import test.test_descr

Expand Down Expand Up @@ -59,6 +59,14 @@ def load_tests(loader, standard_tests, pattern):
test.test_descr.ClassPropertiesAndMethods('test_restored_object_new'), # TODO: marked as expectedFailure but doesn't fail
]

if is_mono:
skip_tests += [
# On Mono, gc.collect() may return before collection is finished making some tests unreliable
test.test_descr.ClassPropertiesAndMethods('test_delete_hook'),
test.test_descr.ClassPropertiesAndMethods('test_subtype_resurrection'),
test.test_descr.ClassPropertiesAndMethods('test_weakrefs'),
]

return generate_suite(tests, failing_tests, skip_tests)

else:
Expand Down
25 changes: 25 additions & 0 deletions Tests/test_io_stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,31 @@ def load_tests(loader, standard_tests, pattern):
test.test_io.PyMiscIOTest('test_attributes'), # AssertionError: 'wb+' != 'rb+'
]

if is_mono:
skip_tests += [
# On Mono, gc.collect() may return before collection is finished making some tests unreliable
test.test_io.CBufferedRandomTest('test_destructor'),
test.test_io.CBufferedWriterTest('test_destructor'),
test.test_io.PyBufferedWriterTest('test_destructor'),
test.test_io.PyBufferedRandomTest('test_destructor'),
test.test_io.PyBufferedReaderTest('test_override_destructor'),
test.test_io.PyBufferedWriterTest('test_override_destructor'),
test.test_io.PyBufferedRandomTest('test_override_destructor'),

test.test_io.CTextIOWrapperTest('test_destructor'),
test.test_io.CIOTest('test_IOBase_finalize'),

test.test_io.PyTextIOWrapperTest('test_destructor'),
test.test_io.PyTextIOWrapperTest('test_override_destructor'),
test.test_io.PyIOTest('test_RawIOBase_destructor'),
test.test_io.PyIOTest('test_BufferedIOBase_destructor'),
test.test_io.PyIOTest('test_IOBase_destructor'),
test.test_io.PyIOTest('test_TextIOBase_destructor'),

test.test_io.CMiscIOTest('test_blockingioerror'),
test.test_io.PyMiscIOTest('test_blockingioerror'),
]

return generate_suite(tests, failing_tests, skip_tests)

else:
Expand Down
8 changes: 7 additions & 1 deletion Tests/test_memoryio_stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## Run selected tests from test_memoryio from StdLib
##

from iptest import is_ironpython, generate_suite, run_test
from iptest import is_ironpython, is_mono, generate_suite, run_test

import test.test_memoryio

Expand All @@ -25,6 +25,12 @@ def load_tests(loader, standard_tests, pattern):
test.test_memoryio.CStringIOTest('test_instance_dict_leak'), # /~https://github.com/IronLanguages/ironpython3/issues/1004
]

if is_mono:
skip_tests += [
# On Mono, gc.collect() may return before collection is finished making some tests unreliable
test.test_memoryio.PyBytesIOTest('test_getbuffer')
]

return generate_suite(tests, failing_tests, skip_tests)

else:
Expand Down
4 changes: 3 additions & 1 deletion Tests/test_namebinding.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# See the LICENSE file in the project root for more information.

import sys
import unittest

from iptest import IronPythonTestCase, is_cli, path_modifier, run_test
from iptest import IronPythonTestCase, is_cli, is_mono, path_modifier, run_test

glb = 0
res = ''
Expand Down Expand Up @@ -312,6 +313,7 @@ def test_DelBuiltin(self):
self.assertRaises(NameError, DoDelBuiltin)
self.assertRaises(NameError, DoDelBuiltin)

@unittest.skipIf(is_mono, "TODO: figure out; the finalizer is called way after WaitForPendingFinalizers")
def test_SimpleTest(self):
"""simple case"""
global res
Expand Down
2 changes: 1 addition & 1 deletion make.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Param(
[Parameter(Position=1)]
[String] $target = "build",
[String] $configuration = "Release",
[String[]] $frameworks=@('net462','netcoreapp3.1','net6.0','net8.0'),
[String[]] $frameworks=@('net462','net6.0','net8.0'),
[String] $platform = $null, # auto-detect
[switch] $runIgnored,
[int] $jobs = [System.Environment]::ProcessorCount
Expand Down

0 comments on commit f610b3d

Please sign in to comment.