Skip to content

Commit

Permalink
gh-93839: Move Lib/ctypes/test/ to Lib/test/test_ctypes/ (#94041)
Browse files Browse the repository at this point in the history
* Move Lib/ctypes/test/ to Lib/test/test_ctypes/
* Remove Lib/test/test_ctypes.py
* Update imports and build system.
  • Loading branch information
vstinner committed Jun 21, 2022
1 parent 889772f commit d82e0bf
Show file tree
Hide file tree
Showing 60 changed files with 83 additions and 93 deletions.
4 changes: 0 additions & 4 deletions Lib/ctypes/test/__main__.py

This file was deleted.

2 changes: 1 addition & 1 deletion Lib/test/leakers/test_ctypes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Taken from Lib/ctypes/test/test_keeprefs.py, PointerToStructure.test().
# Taken from Lib/test/test_ctypes/test_keeprefs.py, PointerToStructure.test().

from ctypes import Structure, c_int, POINTER
import gc
Expand Down
10 changes: 0 additions & 10 deletions Lib/test/test_ctypes.py

This file was deleted.

File renamed without changes.
4 changes: 4 additions & 0 deletions Lib/test/test_ctypes/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from test.test_ctypes import load_tests
import unittest

unittest.main()
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys
from ctypes import *

from ctypes.test import need_symbol
from test.test_ctypes import need_symbol

formats = "bBhHiIlLqQfd"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol
import _ctypes_test

dll = CDLL(_ctypes_test.__file__)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol
from test import support
import unittest
import os
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol
import unittest

class StringBufferTestCase(unittest.TestCase):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from test import support

from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol
from _ctypes import CTYPES_MAX_ARGCOUNT
import _ctypes_test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol
import unittest
import sys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import unittest
from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol

import _ctypes_test

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest

from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol

class CHECKED(c_int):
def _check_retval_(value):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""

from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol
import sys, unittest

try:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from test import support
import unittest
from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol

class MemFunctionsTest(unittest.TestCase):
@unittest.skip('test disabled')
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
of 'x' ('_b_base_' is either None, or the root object owning the memory block):
>>> print(x.array._b_base_) # doctest: +ELLIPSIS
<ctypes.test.test_objects.X object at 0x...>
<test.test_ctypes.test_objects.X object at 0x...>
>>>
>>> x.array[0] = b'spam spam spam'
Expand All @@ -56,12 +56,12 @@

import unittest, doctest

import ctypes.test.test_objects
import test.test_ctypes.test_objects

class TestCase(unittest.TestCase):
def test(self):
failures, tests = doctest.testmod(ctypes.test.test_objects)
failures, tests = doctest.testmod(test.test_ctypes.test_objects)
self.assertFalse(failures, 'doctests failed, see output above')

if __name__ == '__main__':
doctest.testmod(ctypes.test.test_objects)
doctest.testmod(test.test_ctypes.test_objects)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol
import test.support

class SimpleTypesTestCase(unittest.TestCase):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol
import unittest

# IMPORTANT INFO:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol

import _ctypes_test

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol

class StringArrayTestCase(unittest.TestCase):
def test(self):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
import unittest
from ctypes import *
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol
from struct import calcsize
import _ctypes_test
from test import support
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
import ctypes
from ctypes.test import need_symbol
from test.test_ctypes import need_symbol

import _ctypes_test

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -1918,8 +1918,7 @@ LIBSUBDIRS= asyncio \
xmlrpc \
zoneinfo \
__phello__
TESTSUBDIRS= ctypes/test \
distutils/tests \
TESTSUBDIRS= distutils/tests \
idlelib/idle_test \
lib2to3/tests \
lib2to3/tests/data \
Expand All @@ -1933,6 +1932,7 @@ TESTSUBDIRS= ctypes/test \
test/libregrtest test/sndhdrdata \
test/subprocessdata test/support \
test/test_asyncio \
test/test_ctypes \
test/test_email test/test_email/data \
test/test_import \
test/test_import/data \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Move ``Lib/ctypes/test/`` to ``Lib/test/test_ctypes/``. Patch by Victor
Stinner.
109 changes: 54 additions & 55 deletions PCbuild/lib.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,59 +83,6 @@
<Compile Include="ctypes\macholib\dylib.py" />
<Compile Include="ctypes\macholib\framework.py" />
<Compile Include="ctypes\macholib\__init__.py" />
<Compile Include="ctypes\test\test_anon.py" />
<Compile Include="ctypes\test\test_arrays.py" />
<Compile Include="ctypes\test\test_array_in_pointer.py" />
<Compile Include="ctypes\test\test_as_parameter.py" />
<Compile Include="ctypes\test\test_bitfields.py" />
<Compile Include="ctypes\test\test_buffers.py" />
<Compile Include="ctypes\test\test_bytes.py" />
<Compile Include="ctypes\test\test_byteswap.py" />
<Compile Include="ctypes\test\test_callbacks.py" />
<Compile Include="ctypes\test\test_cast.py" />
<Compile Include="ctypes\test\test_cfuncs.py" />
<Compile Include="ctypes\test\test_checkretval.py" />
<Compile Include="ctypes\test\test_delattr.py" />
<Compile Include="ctypes\test\test_errno.py" />
<Compile Include="ctypes\test\test_find.py" />
<Compile Include="ctypes\test\test_frombuffer.py" />
<Compile Include="ctypes\test\test_funcptr.py" />
<Compile Include="ctypes\test\test_functions.py" />
<Compile Include="ctypes\test\test_incomplete.py" />
<Compile Include="ctypes\test\test_init.py" />
<Compile Include="ctypes\test\test_internals.py" />
<Compile Include="ctypes\test\test_keeprefs.py" />
<Compile Include="ctypes\test\test_libc.py" />
<Compile Include="ctypes\test\test_loading.py" />
<Compile Include="ctypes\test\test_macholib.py" />
<Compile Include="ctypes\test\test_memfunctions.py" />
<Compile Include="ctypes\test\test_numbers.py" />
<Compile Include="ctypes\test\test_objects.py" />
<Compile Include="ctypes\test\test_parameters.py" />
<Compile Include="ctypes\test\test_pep3118.py" />
<Compile Include="ctypes\test\test_pickling.py" />
<Compile Include="ctypes\test\test_pointers.py" />
<Compile Include="ctypes\test\test_prototypes.py" />
<Compile Include="ctypes\test\test_python_api.py" />
<Compile Include="ctypes\test\test_random_things.py" />
<Compile Include="ctypes\test\test_refcounts.py" />
<Compile Include="ctypes\test\test_repr.py" />
<Compile Include="ctypes\test\test_returnfuncptrs.py" />
<Compile Include="ctypes\test\test_simplesubclasses.py" />
<Compile Include="ctypes\test\test_sizes.py" />
<Compile Include="ctypes\test\test_slicing.py" />
<Compile Include="ctypes\test\test_stringptr.py" />
<Compile Include="ctypes\test\test_strings.py" />
<Compile Include="ctypes\test\test_structures.py" />
<Compile Include="ctypes\test\test_struct_fields.py" />
<Compile Include="ctypes\test\test_unaligned_structures.py" />
<Compile Include="ctypes\test\test_unicode.py" />
<Compile Include="ctypes\test\test_values.py" />
<Compile Include="ctypes\test\test_varsize_struct.py" />
<Compile Include="ctypes\test\test_win32.py" />
<Compile Include="ctypes\test\test_wintypes.py" />
<Compile Include="ctypes\test\__init__.py" />
<Compile Include="ctypes\test\__main__.py" />
<Compile Include="ctypes\util.py" />
<Compile Include="ctypes\wintypes.py" />
<Compile Include="ctypes\_endian.py" />
Expand Down Expand Up @@ -944,7 +891,59 @@
<Compile Include="test\test_crashers.py" />
<Compile Include="test\test_crypt.py" />
<Compile Include="test\test_csv.py" />
<Compile Include="test\test_ctypes.py" />
<Compile Include="test\test_ctypes\test_anon.py" />
<Compile Include="test\test_ctypes\test_arrays.py" />
<Compile Include="test\test_ctypes\test_array_in_pointer.py" />
<Compile Include="test\test_ctypes\test_as_parameter.py" />
<Compile Include="test\test_ctypes\test_bitfields.py" />
<Compile Include="test\test_ctypes\test_buffers.py" />
<Compile Include="test\test_ctypes\test_bytes.py" />
<Compile Include="test\test_ctypes\test_byteswap.py" />
<Compile Include="test\test_ctypes\test_callbacks.py" />
<Compile Include="test\test_ctypes\test_cast.py" />
<Compile Include="test\test_ctypes\test_cfuncs.py" />
<Compile Include="test\test_ctypes\test_checkretval.py" />
<Compile Include="test\test_ctypes\test_delattr.py" />
<Compile Include="test\test_ctypes\test_errno.py" />
<Compile Include="test\test_ctypes\test_find.py" />
<Compile Include="test\test_ctypes\test_frombuffer.py" />
<Compile Include="test\test_ctypes\test_funcptr.py" />
<Compile Include="test\test_ctypes\test_functions.py" />
<Compile Include="test\test_ctypes\test_incomplete.py" />
<Compile Include="test\test_ctypes\test_init.py" />
<Compile Include="test\test_ctypes\test_internals.py" />
<Compile Include="test\test_ctypes\test_keeprefs.py" />
<Compile Include="test\test_ctypes\test_libc.py" />
<Compile Include="test\test_ctypes\test_loading.py" />
<Compile Include="test\test_ctypes\test_macholib.py" />
<Compile Include="test\test_ctypes\test_memfunctions.py" />
<Compile Include="test\test_ctypes\test_numbers.py" />
<Compile Include="test\test_ctypes\test_objects.py" />
<Compile Include="test\test_ctypes\test_parameters.py" />
<Compile Include="test\test_ctypes\test_pep3118.py" />
<Compile Include="test\test_ctypes\test_pickling.py" />
<Compile Include="test\test_ctypes\test_pointers.py" />
<Compile Include="test\test_ctypes\test_prototypes.py" />
<Compile Include="test\test_ctypes\test_python_api.py" />
<Compile Include="test\test_ctypes\test_random_things.py" />
<Compile Include="test\test_ctypes\test_refcounts.py" />
<Compile Include="test\test_ctypes\test_repr.py" />
<Compile Include="test\test_ctypes\test_returnfuncptrs.py" />
<Compile Include="test\test_ctypes\test_simplesubclasses.py" />
<Compile Include="test\test_ctypes\test_sizes.py" />
<Compile Include="test\test_ctypes\test_slicing.py" />
<Compile Include="test\test_ctypes\test_stringptr.py" />
<Compile Include="test\test_ctypes\test_strings.py" />
<Compile Include="test\test_ctypes\test_structures.py" />
<Compile Include="test\test_ctypes\test_struct_fields.py" />
<Compile Include="test\test_ctypes\test_unaligned_structures.py" />
<Compile Include="test\test_ctypes\test_unicode.py" />
<Compile Include="test\test_ctypes\test_values.py" />
<Compile Include="test\test_ctypes\test_varsize_struct.py" />
<Compile Include="test\test_ctypes\test_win32.py" />
<Compile Include="test\test_ctypes\test_wintypes.py" />
<Compile Include="test\test_ctypes\__init__.py" />
<Compile Include="test\test_ctypes\__main__.py" />
<Compile Include="test\test_curses.py" />
<Compile Include="test\test_datetime.py" />
<Compile Include="test\test_dbm.py" />
Expand Down Expand Up @@ -1725,7 +1724,6 @@
<Folder Include="concurrent\futures" />
<Folder Include="ctypes" />
<Folder Include="ctypes\macholib" />
<Folder Include="ctypes\test" />
<Folder Include="curses" />
<Folder Include="dbm" />
<Folder Include="distutils" />
Expand Down Expand Up @@ -1769,6 +1767,7 @@
<Folder Include="test\subprocessdata" />
<Folder Include="test\support" />
<Folder Include="test\test_asyncio" />
<Folder Include="test\test_ctypes" />
<Folder Include="test\test_email" />
<Folder Include="test\test_email\data" />
<Folder Include="test\test_import" />
Expand Down
1 change: 0 additions & 1 deletion Tools/wasm/wasm_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@

# regression test sub directories
OMIT_SUBDIRS = (
"ctypes/test/",
"tkinter/test/",
"unittest/test/",
)
Expand Down

0 comments on commit d82e0bf

Please sign in to comment.