@@ -1929,7 +1925,7 @@ internal static IntPtr PyImport_ImportModule(string name)
internal static IntPtr PyImport_ReloadModule(IntPtr module) => Delegates.PyImport_ReloadModule(module);
-
+
internal static BorrowedReference PyImport_AddModule(string name)
{
using var namePtr = new StrPtr(name, Encoding.UTF8);
@@ -1938,7 +1934,7 @@ internal static BorrowedReference PyImport_AddModule(string name)
internal static BorrowedReference PyImport_GetModuleDict() => Delegates.PyImport_GetModuleDict();
-
+
internal static void PySys_SetArgvEx(int argc, string[] argv, int updatepath)
{
var marshaler = StrArrayMarshaler.GetInstance(null);
@@ -1979,7 +1975,7 @@ internal static bool PyType_Check(IntPtr ob)
return PyObject_TypeCheck(ob, PyTypeType);
}
-
+
internal static void PyType_Modified(IntPtr type) => Delegates.PyType_Modified(type);
internal static bool PyType_IsSubtype(BorrowedReference t1, IntPtr ofType)
=> PyType_IsSubtype(t1, new BorrowedReference(ofType));
@@ -2000,7 +1996,7 @@ internal static bool PyType_IsSameAsOrSubtype(BorrowedReference type, BorrowedRe
return (type == ofType) || PyType_IsSubtype(type, ofType);
}
-
+
internal static IntPtr PyType_GenericNew(IntPtr type, IntPtr args, IntPtr kw) => Delegates.PyType_GenericNew(type, args, kw);
internal static IntPtr PyType_GenericAlloc(IntPtr type, long n)
@@ -2008,37 +2004,37 @@ internal static IntPtr PyType_GenericAlloc(IntPtr type, long n)
return PyType_GenericAlloc(type, new IntPtr(n));
}
-
+
private static IntPtr PyType_GenericAlloc(IntPtr type, IntPtr n) => Delegates.PyType_GenericAlloc(type, n);
///
/// Finalize a type object. This should be called on all type objects to finish their initialization. This function is responsible for adding inherited slots from a type’s base class. Return 0 on success, or return -1 and sets an exception on error.
///
-
+
internal static int PyType_Ready(IntPtr type) => Delegates.PyType_Ready(type);
-
+
internal static IntPtr _PyType_Lookup(IntPtr type, IntPtr name) => Delegates._PyType_Lookup(type, name);
-
+
internal static IntPtr PyObject_GenericGetAttr(IntPtr obj, IntPtr name) => Delegates.PyObject_GenericGetAttr(obj, name);
-
+
internal static int PyObject_GenericSetAttr(IntPtr obj, IntPtr name, IntPtr value) => Delegates.PyObject_GenericSetAttr(obj, name, value);
-
+
internal static BorrowedReference* _PyObject_GetDictPtr(BorrowedReference obj) => Delegates._PyObject_GetDictPtr(obj);
-
+
internal static void PyObject_GC_Del(IntPtr tp) => Delegates.PyObject_GC_Del(tp);
-
+
internal static void PyObject_GC_Track(IntPtr tp) => Delegates.PyObject_GC_Track(tp);
-
+
internal static void PyObject_GC_UnTrack(IntPtr tp) => Delegates.PyObject_GC_UnTrack(tp);
-
+
internal static void _PyObject_Dump(IntPtr ob) => Delegates._PyObject_Dump(ob);
//====================================================================
@@ -2050,7 +2046,7 @@ internal static IntPtr PyMem_Malloc(long size)
return PyMem_Malloc(new IntPtr(size));
}
-
+
private static IntPtr PyMem_Malloc(IntPtr size) => Delegates.PyMem_Malloc(size);
internal static IntPtr PyMem_Realloc(IntPtr ptr, long size)
@@ -2058,10 +2054,10 @@ internal static IntPtr PyMem_Realloc(IntPtr ptr, long size)
return PyMem_Realloc(ptr, new IntPtr(size));
}
-
+
private static IntPtr PyMem_Realloc(IntPtr ptr, IntPtr size) => Delegates.PyMem_Realloc(ptr, size);
-
+
internal static void PyMem_Free(IntPtr ptr) => Delegates.PyMem_Free(ptr);
@@ -2069,7 +2065,7 @@ internal static IntPtr PyMem_Realloc(IntPtr ptr, long size)
// Python exception API
//====================================================================
-
+
internal static void PyErr_SetString(IntPtr ob, string message)
{
using var msgPtr = new StrPtr(message, Encoding.UTF8);
@@ -2078,40 +2074,40 @@ internal static void PyErr_SetString(IntPtr ob, string message)
internal static void PyErr_SetObject(BorrowedReference type, BorrowedReference exceptionObject) => Delegates.PyErr_SetObject(type, exceptionObject);
-
+
internal static IntPtr PyErr_SetFromErrno(IntPtr ob) => Delegates.PyErr_SetFromErrno(ob);
-
+
internal static void PyErr_SetNone(IntPtr ob) => Delegates.PyErr_SetNone(ob);
-
+
internal static int PyErr_ExceptionMatches(IntPtr exception) => Delegates.PyErr_ExceptionMatches(exception);
-
+
internal static int PyErr_GivenExceptionMatches(IntPtr ob, IntPtr val) => Delegates.PyErr_GivenExceptionMatches(ob, val);
-
+
internal static void PyErr_NormalizeException(ref IntPtr ob, ref IntPtr val, ref IntPtr tb) => Delegates.PyErr_NormalizeException(ref ob, ref val, ref tb);
-
+
internal static IntPtr PyErr_Occurred() => Delegates.PyErr_Occurred();
-
+
internal static void PyErr_Fetch(out IntPtr ob, out IntPtr val, out IntPtr tb) => Delegates.PyErr_Fetch(out ob, out val, out tb);
-
+
internal static void PyErr_Restore(IntPtr ob, IntPtr val, IntPtr tb) => Delegates.PyErr_Restore(ob, val, tb);
-
+
internal static void PyErr_Clear() => Delegates.PyErr_Clear();
-
+
internal static void PyErr_Print() => Delegates.PyErr_Print();
///
/// Set the cause associated with the exception to cause. Use NULL to clear it. There is no type check to make sure that cause is either an exception instance or None. This steals a reference to cause.
///
-
+
internal static void PyException_SetCause(IntPtr ex, IntPtr cause) => Delegates.PyException_SetCause(ex, cause);
//====================================================================
@@ -2121,7 +2117,7 @@ internal static void PyErr_SetString(IntPtr ob, string message)
internal static NewReference PyCell_Get(BorrowedReference cell) => Delegates.PyCell_Get(cell);
-
+
internal static int PyCell_Set(BorrowedReference cell, IntPtr value) => Delegates.PyCell_Set(cell, value);
//====================================================================
@@ -2134,7 +2130,7 @@ internal static void PyErr_SetString(IntPtr ob, string message)
internal const long _PyGC_REFS_TENTATIVELY_UNREACHABLE = -4;
-
+
internal static IntPtr PyGC_Collect() => Delegates.PyGC_Collect();
internal static IntPtr _Py_AS_GC(BorrowedReference ob)
@@ -2196,18 +2192,18 @@ internal static IntPtr PyCapsule_GetPointer(BorrowedReference capsule, IntPtr na
// Miscellaneous
//====================================================================
-
+
internal static IntPtr PyMethod_Self(IntPtr ob) => Delegates.PyMethod_Self(ob);
-
+
internal static IntPtr PyMethod_Function(IntPtr ob) => Delegates.PyMethod_Function(ob);
-
+
internal static int Py_AddPendingCall(IntPtr func, IntPtr arg) => Delegates.Py_AddPendingCall(func, arg);
-
+
internal static int PyThreadState_SetAsyncExcLLP64(uint id, IntPtr exc) => Delegates.PyThreadState_SetAsyncExcLLP64(id, exc);
-
+
internal static int PyThreadState_SetAsyncExcLP64(ulong id, IntPtr exc) => Delegates.PyThreadState_SetAsyncExcLP64(id, exc);
@@ -2789,6 +2785,7 @@ public enum ShutdownMode
Normal,
Soft,
Reload,
+ Extension,
}
diff --git a/src/testing/Python.Test.csproj b/src/testing/Python.Test.csproj
index e6e11c1da..4b7e4d93b 100644
--- a/src/testing/Python.Test.csproj
+++ b/src/testing/Python.Test.csproj
@@ -1,14 +1,11 @@
- netstandard2.0
+ netstandard2.0;net5.0
true
+ true
-
-
-
-
diff --git a/src/testing/arraytest.cs b/src/testing/arraytest.cs
index 946684962..a3c94e019 100644
--- a/src/testing/arraytest.cs
+++ b/src/testing/arraytest.cs
@@ -314,4 +314,16 @@ public static Spam[][] EchoRangeAA(Spam[][] items)
return items;
}
}
+
+ public struct Point
+ {
+ public Point(float x, float y)
+ {
+ X = x;
+ Y = y;
+ }
+
+ public float X { get; set; }
+ public float Y { get; set; }
+ }
}
diff --git a/src/tests/conftest.py b/src/tests/conftest.py
deleted file mode 100644
index 17085e3ef..000000000
--- a/src/tests/conftest.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-# TODO: move tests one out of src to project root.
-# TODO: travis has numpy on their workers. Maybe add tests?
-
-"""Helpers for testing."""
-
-import ctypes
-import os
-import sys
-import sysconfig
-
-import pytest
-
-# Add path for `Python.Test`
-cwd = os.path.dirname(__file__)
-fixtures_path = os.path.join(cwd, "fixtures")
-
-BUILD_TEST = True
-if BUILD_TEST:
- from subprocess import check_call
- test_proj_path = os.path.join(cwd, "..", "testing")
- check_call(["dotnet", "build", test_proj_path, "-o", fixtures_path])
-
-sys.path.append(fixtures_path)
-
-import clr
-
-# Add References for tests
-clr.AddReference("Python.Test")
-clr.AddReference("System.Collections")
-clr.AddReference("System.Data")
-
-
-def pytest_report_header(config):
- """Generate extra report headers"""
- # FIXME: https://github.com/pytest-dev/pytest/issues/2257
- is_64bits = sys.maxsize > 2**32
- arch = "x64" if is_64bits else "x86"
- ucs = ctypes.sizeof(ctypes.c_wchar)
- libdir = sysconfig.get_config_var("LIBDIR")
- shared = bool(sysconfig.get_config_var("Py_ENABLE_SHARED"))
-
- header = ("Arch: {arch}, UCS: {ucs}, LIBDIR: {libdir}, "
- "Py_ENABLE_SHARED: {shared}".format(**locals()))
- return header
-
-
-@pytest.fixture()
-def filepath():
- """Returns full filepath for file in `fixtures` directory."""
-
- def make_filepath(filename):
- # http://stackoverflow.com/questions/18011902/parameter-to-a-fixture
- return os.path.join(fixtures_path, filename)
-
- return make_filepath
diff --git a/src/tests/fixtures/.gitkeep b/src/tests/fixtures/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/tests/fixtures/netstandard2.0/.gitkeep b/src/tests/fixtures/netstandard2.0/.gitkeep
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/tests/__init__.py b/tests/__init__.py
similarity index 100%
rename from src/tests/__init__.py
rename to tests/__init__.py
diff --git a/src/tests/_missing_import.py b/tests/_missing_import.py
similarity index 100%
rename from src/tests/_missing_import.py
rename to tests/_missing_import.py
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 000000000..cf3341f01
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,106 @@
+# -*- coding: utf-8 -*-
+# TODO: move tests one out of src to project root.
+# TODO: travis has numpy on their workers. Maybe add tests?
+
+"""Helpers for testing."""
+
+import ctypes
+import os
+import sys
+import sysconfig
+from subprocess import check_call
+from tempfile import mkdtemp
+import shutil
+
+import pytest
+
+from pythonnet import set_runtime
+
+# Add path for `Python.Test`
+cwd = os.path.dirname(__file__)
+fixtures_path = os.path.join(cwd, "fixtures")
+sys.path.append(fixtures_path)
+
+def pytest_addoption(parser):
+ parser.addoption(
+ "--runtime",
+ action="store",
+ default="default",
+ help="Must be one of default, netcore, netfx and mono"
+ )
+
+def pytest_configure(config):
+ global bin_path
+ if "clr" in sys.modules:
+ # Already loaded (e.g. by the C# test runner), skip build
+ import clr
+ clr.AddReference("Python.Test")
+ return
+
+ runtime_opt = config.getoption("runtime")
+
+ test_proj_path = os.path.join(cwd, "..", "src", "testing")
+
+ if runtime_opt not in ["netcore", "netfx", "mono", "default"]:
+ raise RuntimeError(f"Invalid runtime: {runtime_opt}")
+
+ bin_path = mkdtemp()
+
+ # tmpdir_factory.mktemp(f"pythonnet-{runtime_opt}")
+
+ fw = "net5.0" if runtime_opt == "netcore" else "netstandard2.0"
+
+ check_call(["dotnet", "publish", "-f", fw, "-o", bin_path, test_proj_path])
+
+ sys.path.append(bin_path)
+
+ if runtime_opt == "default":
+ pass
+ elif runtime_opt == "netfx":
+ from clr_loader import get_netfx
+ runtime = get_netfx()
+ set_runtime(runtime)
+ elif runtime_opt == "mono":
+ from clr_loader import get_mono
+ runtime = get_mono()
+ set_runtime(runtime)
+ elif runtime_opt == "netcore":
+ from clr_loader import get_coreclr
+ rt_config_path = os.path.join(bin_path, "Python.Test.runtimeconfig.json")
+ runtime = get_coreclr(rt_config_path)
+ set_runtime(runtime)
+
+ import clr
+ clr.AddReference("Python.Test")
+
+
+def pytest_unconfigure(config):
+ global bin_path
+ try:
+ shutil.rmtree(bin_path)
+ except Exception:
+ pass
+
+def pytest_report_header(config):
+ """Generate extra report headers"""
+ # FIXME: https://github.com/pytest-dev/pytest/issues/2257
+ is_64bits = sys.maxsize > 2**32
+ arch = "x64" if is_64bits else "x86"
+ ucs = ctypes.sizeof(ctypes.c_wchar)
+ libdir = sysconfig.get_config_var("LIBDIR")
+ shared = bool(sysconfig.get_config_var("Py_ENABLE_SHARED"))
+
+ header = ("Arch: {arch}, UCS: {ucs}, LIBDIR: {libdir}, "
+ "Py_ENABLE_SHARED: {shared}".format(**locals()))
+ return header
+
+
+@pytest.fixture()
+def filepath():
+ """Returns full filepath for file in `fixtures` directory."""
+
+ def make_filepath(filename):
+ # http://stackoverflow.com/questions/18011902/parameter-to-a-fixture
+ return os.path.join(fixtures_path, filename)
+
+ return make_filepath
diff --git a/src/tests/fixtures/argv-fixture.py b/tests/fixtures/argv-fixture.py
similarity index 100%
rename from src/tests/fixtures/argv-fixture.py
rename to tests/fixtures/argv-fixture.py
diff --git a/src/tests/importtest.py b/tests/importtest.py
similarity index 100%
rename from src/tests/importtest.py
rename to tests/importtest.py
diff --git a/src/tests/leaktest.py b/tests/leaktest.py
similarity index 100%
rename from src/tests/leaktest.py
rename to tests/leaktest.py
diff --git a/src/tests/profile.py b/tests/profile.py
similarity index 100%
rename from src/tests/profile.py
rename to tests/profile.py
diff --git a/src/tests/runtests.py b/tests/runtests.py
similarity index 100%
rename from src/tests/runtests.py
rename to tests/runtests.py
diff --git a/src/tests/stress.py b/tests/stress.py
similarity index 100%
rename from src/tests/stress.py
rename to tests/stress.py
diff --git a/src/tests/stresstest.py b/tests/stresstest.py
similarity index 100%
rename from src/tests/stresstest.py
rename to tests/stresstest.py
diff --git a/src/tests/test_array.py b/tests/test_array.py
similarity index 99%
rename from src/tests/test_array.py
rename to tests/test_array.py
index 232c89ac7..2b1a289ad 100644
--- a/src/tests/test_array.py
+++ b/tests/test_array.py
@@ -1166,10 +1166,8 @@ def test_boxed_value_type_mutation_result():
# to accidentally write code like the following which is not really
# mutating value types in-place but changing boxed copies.
- clr.AddReference('System.Drawing')
-
- from System.Drawing import Point
from System import Array
+ from Python.Test import Point
items = Array.CreateInstance(Point, 5)
diff --git a/src/tests/test_callback.py b/tests/test_callback.py
similarity index 100%
rename from src/tests/test_callback.py
rename to tests/test_callback.py
diff --git a/src/tests/test_class.py b/tests/test_class.py
similarity index 99%
rename from src/tests/test_class.py
rename to tests/test_class.py
index 4666631f7..f961b3975 100644
--- a/src/tests/test_class.py
+++ b/tests/test_class.py
@@ -126,9 +126,7 @@ def __init__(self, v):
def test_struct_construction():
"""Test construction of structs."""
- clr.AddReference('System.Drawing')
-
- from System.Drawing import Point
+ from Python.Test import Point
p = Point()
assert p.X == 0
diff --git a/src/tests/test_clrmethod.py b/tests/test_clrmethod.py
similarity index 100%
rename from src/tests/test_clrmethod.py
rename to tests/test_clrmethod.py
diff --git a/src/tests/test_constructors.py b/tests/test_constructors.py
similarity index 100%
rename from src/tests/test_constructors.py
rename to tests/test_constructors.py
diff --git a/src/tests/test_conversion.py b/tests/test_conversion.py
similarity index 99%
rename from src/tests/test_conversion.py
rename to tests/test_conversion.py
index 3b290b947..aea95e164 100644
--- a/src/tests/test_conversion.py
+++ b/tests/test_conversion.py
@@ -406,8 +406,8 @@ def test_uint64_conversion():
def test_single_conversion():
"""Test single conversion."""
- assert System.Single.MaxValue == 3.402823e38
- assert System.Single.MinValue == -3.402823e38
+ assert System.Single.MaxValue == pytest.approx(3.402823e38)
+ assert System.Single.MinValue == pytest.approx(-3.402823e38)
ob = ConversionTest()
assert ob.SingleField == 0.0
diff --git a/src/tests/test_delegate.py b/tests/test_delegate.py
similarity index 100%
rename from src/tests/test_delegate.py
rename to tests/test_delegate.py
diff --git a/src/tests/test_docstring.py b/tests/test_docstring.py
similarity index 100%
rename from src/tests/test_docstring.py
rename to tests/test_docstring.py
diff --git a/src/tests/test_engine.py b/tests/test_engine.py
similarity index 100%
rename from src/tests/test_engine.py
rename to tests/test_engine.py
diff --git a/src/tests/test_enum.py b/tests/test_enum.py
similarity index 100%
rename from src/tests/test_enum.py
rename to tests/test_enum.py
diff --git a/src/tests/test_event.py b/tests/test_event.py
similarity index 100%
rename from src/tests/test_event.py
rename to tests/test_event.py
diff --git a/src/tests/test_exceptions.py b/tests/test_exceptions.py
similarity index 100%
rename from src/tests/test_exceptions.py
rename to tests/test_exceptions.py
diff --git a/src/tests/test_field.py b/tests/test_field.py
similarity index 100%
rename from src/tests/test_field.py
rename to tests/test_field.py
diff --git a/src/tests/test_generic.py b/tests/test_generic.py
similarity index 100%
rename from src/tests/test_generic.py
rename to tests/test_generic.py
diff --git a/src/tests/test_import.py b/tests/test_import.py
similarity index 100%
rename from src/tests/test_import.py
rename to tests/test_import.py
diff --git a/src/tests/test_indexer.py b/tests/test_indexer.py
similarity index 100%
rename from src/tests/test_indexer.py
rename to tests/test_indexer.py
diff --git a/src/tests/test_interface.py b/tests/test_interface.py
similarity index 100%
rename from src/tests/test_interface.py
rename to tests/test_interface.py
diff --git a/src/tests/test_method.py b/tests/test_method.py
similarity index 99%
rename from src/tests/test_method.py
rename to tests/test_method.py
index 2826ad467..9bdb571c0 100644
--- a/src/tests/test_method.py
+++ b/tests/test_method.py
@@ -899,9 +899,6 @@ def test_object_in_multiparam_exception():
c = e.__cause__
assert c.GetType().FullName == 'System.AggregateException'
assert len(c.InnerExceptions) == 2
- message = 'One or more errors occurred.'
- s = str(c)
- assert s[0:len(message)] == message
def test_case_sensitive():
"""Test that case-sensitivity is respected. GH#81"""
diff --git a/src/tests/test_module.py b/tests/test_module.py
similarity index 92%
rename from src/tests/test_module.py
rename to tests/test_module.py
index dcdb0248e..d0378e91e 100644
--- a/src/tests/test_module.py
+++ b/tests/test_module.py
@@ -30,7 +30,7 @@ def test_import_clr():
def test_version_clr():
import clr
- assert clr.__version__ >= "2.2.0"
+ assert clr.__version__ >= "3.0.0"
def test_preload_var():
@@ -111,12 +111,13 @@ def test_dotted_name_import():
def test_multiple_dotted_name_import():
"""Test an import bug with multiple dotted imports."""
- import System.Data
- assert is_clr_module(System.Data)
- assert System.Data.__name__ == 'System.Data'
- import System.Data
- assert is_clr_module(System.Data)
- assert System.Data.__name__ == 'System.Data'
+
+ import System.Reflection
+ assert is_clr_module(System.Reflection)
+ assert System.Reflection.__name__ == 'System.Reflection'
+ import System.Reflection
+ assert is_clr_module(System.Reflection)
+ assert System.Reflection.__name__ == 'System.Reflection'
def test_dotted_name_import_with_alias():
@@ -192,11 +193,11 @@ def test_dotted_name_import_from_with_alias():
def test_from_module_import_star():
"""Test from module import * behavior."""
- clr.AddReference('System.Xml')
-
+ clr.AddReference("System")
+
count = len(locals().keys())
- m = __import__('System.Xml', globals(), locals(), ['*'])
- assert m.__name__ == 'System.Xml'
+ m = __import__('System', globals(), locals(), ['*'])
+ assert m.__name__ == 'System'
assert is_clr_module(m)
assert len(locals().keys()) > count + 1
@@ -212,7 +213,11 @@ def test_implicit_assembly_load():
import Microsoft.Build
with warnings.catch_warnings(record=True) as w:
- clr.AddReference("System.Windows.Forms")
+ try:
+ clr.AddReference("System.Windows.Forms")
+ except Exception:
+ pytest.skip()
+
import System.Windows.Forms as Forms
assert is_clr_module(Forms)
assert Forms.__name__ == 'System.Windows.Forms'
@@ -227,11 +232,11 @@ def test_explicit_assembly_load():
from System.Reflection import Assembly
import System, sys
- assembly = Assembly.LoadWithPartialName('System.Data')
+ assembly = Assembly.LoadWithPartialName('System.Runtime')
assert assembly is not None
- import System.Data
- assert 'System.Data' in sys.modules
+ import System.Runtime
+ assert 'System.Runtime' in sys.modules
assembly = Assembly.LoadWithPartialName('SpamSpamSpamSpamEggsAndSpam')
assert assembly is None
@@ -275,12 +280,14 @@ def test_module_lookup_recursion():
def test_module_get_attr():
"""Test module getattr behavior."""
+
import System
+ import System.Runtime
int_type = System.Int32
assert is_clr_class(int_type)
- module = System.Xml
+ module = System.Runtime
assert is_clr_module(module)
with pytest.raises(AttributeError):
@@ -324,7 +331,6 @@ def test_clr_list_assemblies():
from clr import ListAssemblies
verbose = list(ListAssemblies(True))
short = list(ListAssemblies(False))
- assert u'mscorlib' in short
assert u'System' in short
assert u'Culture=' in verbose[0]
assert u'Version=' in verbose[0]
@@ -377,8 +383,11 @@ def test_assembly_load_thread_safety():
_ = Dictionary[Guid, DateTime]()
ModuleTest.JoinThreads()
+@pytest.mark.skipif()
def test_assembly_load_recursion_bug():
"""Test fix for recursion bug documented in #627"""
- from System.Configuration import ConfigurationManager
- content = dir(ConfigurationManager)
+ sys_config = pytest.importorskip(
+ "System.Configuration", reason="System.Configuration can't be imported"
+ )
+ content = dir(sys_config.ConfigurationManager)
assert len(content) > 5, content
diff --git a/src/tests/test_mp_length.py b/tests/test_mp_length.py
similarity index 100%
rename from src/tests/test_mp_length.py
rename to tests/test_mp_length.py
diff --git a/src/tests/test_property.py b/tests/test_property.py
similarity index 100%
rename from src/tests/test_property.py
rename to tests/test_property.py
diff --git a/src/tests/test_recursive_types.py b/tests/test_recursive_types.py
similarity index 100%
rename from src/tests/test_recursive_types.py
rename to tests/test_recursive_types.py
diff --git a/src/tests/test_repr.py b/tests/test_repr.py
similarity index 100%
rename from src/tests/test_repr.py
rename to tests/test_repr.py
diff --git a/src/tests/test_subclass.py b/tests/test_subclass.py
similarity index 100%
rename from src/tests/test_subclass.py
rename to tests/test_subclass.py
diff --git a/src/tests/test_sysargv.py b/tests/test_sysargv.py
similarity index 77%
rename from src/tests/test_sysargv.py
rename to tests/test_sysargv.py
index dd62bc632..d856ec902 100644
--- a/src/tests/test_sysargv.py
+++ b/tests/test_sysargv.py
@@ -2,6 +2,7 @@
import sys
from subprocess import check_output
+from ast import literal_eval
def test_sys_argv_state(filepath):
@@ -11,5 +12,5 @@ def test_sys_argv_state(filepath):
script = filepath("argv-fixture.py")
out = check_output([sys.executable, script, "foo", "bar"])
- assert b"foo" in out
- assert b"bar" in out
+ out = literal_eval(out.decode("ascii"))
+ assert out[-2:] == ["foo", "bar"]
diff --git a/src/tests/test_thread.py b/tests/test_thread.py
similarity index 100%
rename from src/tests/test_thread.py
rename to tests/test_thread.py
diff --git a/src/tests/tests.pyproj b/tests/tests.pyproj
similarity index 100%
rename from src/tests/tests.pyproj
rename to tests/tests.pyproj
diff --git a/src/tests/utils.py b/tests/utils.py
similarity index 100%
rename from src/tests/utils.py
rename to tests/utils.py
diff --git a/tools/geninterop/geninterop.py b/tools/geninterop/geninterop.py
index 0d5b83b30..0c80c1904 100644
--- a/tools/geninterop/geninterop.py
+++ b/tools/geninterop/geninterop.py
@@ -225,8 +225,6 @@ def preprocess_python_headers():
if hasattr(sys, "abiflags"):
if "d" in sys.abiflags:
defines.extend(("-D", "PYTHON_WITH_PYDEBUG"))
- if "m" in sys.abiflags:
- defines.extend(("-D", "PYTHON_WITH_PYMALLOC"))
if "u" in sys.abiflags:
defines.extend(("-D", "PYTHON_WITH_WIDE_UNICODE"))
@@ -245,7 +243,7 @@ def preprocess_python_headers():
def gen_interop_head(writer):
filename = os.path.basename(__file__)
- abi_flags = getattr(sys, "abiflags", "")
+ abi_flags = getattr(sys, "abiflags", "").replace("m", "")
py_ver = "{0}.{1}".format(PY_MAJOR, PY_MINOR)
class_definition = """
// Auto-generated by %s.
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy