From 98443640659a9f9b8a0fb97756cb13e032f39644 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Jun 2022 11:37:40 +0200 Subject: [PATCH 1/8] gh-54781: Move Lib/tkinter/test/test_ttk/ to Lib/test/test_ttk/ * Add Lib/test/test_ttk/__init__.py based on test_ttk_guionly.py. * Remove Lib/test/test_ttk_guionly.py. --- .../{test_ttk_guionly.py => test_ttk/__init__.py} | 11 ++++++----- Lib/{tkinter => }/test/test_ttk/test_extensions.py | 0 Lib/{tkinter => }/test/test_ttk/test_style.py | 0 Lib/{tkinter => }/test/test_ttk/test_widgets.py | 0 Lib/tkinter/test/test_ttk/__init__.py | 0 5 files changed, 6 insertions(+), 5 deletions(-) rename Lib/test/{test_ttk_guionly.py => test_ttk/__init__.py} (73%) rename Lib/{tkinter => }/test/test_ttk/test_extensions.py (100%) rename Lib/{tkinter => }/test/test_ttk/test_style.py (100%) rename Lib/{tkinter => }/test/test_ttk/test_widgets.py (100%) delete mode 100644 Lib/tkinter/test/test_ttk/__init__.py diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk/__init__.py similarity index 73% rename from Lib/test/test_ttk_guionly.py rename to Lib/test/test_ttk/__init__.py index c4919045d75cb7..9b054b49912e66 100644 --- a/Lib/test/test_ttk_guionly.py +++ b/Lib/test/test_ttk/__init__.py @@ -1,10 +1,10 @@ +import os.path import unittest from test import support from test.support import import_helper -from test.support import check_sanitizer -if check_sanitizer(address=True, memory=True): - raise unittest.SkipTest("Tests involvin libX11 can SEGFAULT on ASAN/MSAN builds") +if support.check_sanitizer(address=True, memory=True): + raise unittest.SkipTest("Tests involving libX11 can SEGFAULT on ASAN/MSAN builds") # Skip this test if _tkinter wasn't built. import_helper.import_module('_tkinter') @@ -12,6 +12,7 @@ # Skip test if tk cannot be initialized. support.requires('gui') + import tkinter from _tkinter import TclError from tkinter import ttk @@ -32,8 +33,8 @@ def setUpModule(): root.destroy() del root -def load_tests(loader, tests, pattern): - return loader.discover('tkinter.test.test_ttk') +def load_tests(*args): + return support.load_package_tests(os.path.dirname(__file__), *args) if __name__ == '__main__': diff --git a/Lib/tkinter/test/test_ttk/test_extensions.py b/Lib/test/test_ttk/test_extensions.py similarity index 100% rename from Lib/tkinter/test/test_ttk/test_extensions.py rename to Lib/test/test_ttk/test_extensions.py diff --git a/Lib/tkinter/test/test_ttk/test_style.py b/Lib/test/test_ttk/test_style.py similarity index 100% rename from Lib/tkinter/test/test_ttk/test_style.py rename to Lib/test/test_ttk/test_style.py diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/test/test_ttk/test_widgets.py similarity index 100% rename from Lib/tkinter/test/test_ttk/test_widgets.py rename to Lib/test/test_ttk/test_widgets.py diff --git a/Lib/tkinter/test/test_ttk/__init__.py b/Lib/tkinter/test/test_ttk/__init__.py deleted file mode 100644 index e69de29bb2d1d6..00000000000000 From 0f60bef3cc44146036a4712f258015c171f735d7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Jun 2022 17:21:49 +0200 Subject: [PATCH 2/8] Move Lib/tkinter/test/ to Lib/test/test_tkinter/ --- Lib/{tkinter/test => test/test_tkinter}/README | 0 Lib/{tkinter/test => test/test_tkinter}/__init__.py | 0 Lib/{tkinter/test => test/test_tkinter}/support.py | 0 Lib/{tkinter => }/test/test_tkinter/test_colorchooser.py | 0 Lib/{tkinter => }/test/test_tkinter/test_font.py | 0 Lib/{tkinter => }/test/test_tkinter/test_geometry_managers.py | 0 Lib/{tkinter => }/test/test_tkinter/test_images.py | 0 Lib/{tkinter => }/test/test_tkinter/test_loadtk.py | 0 Lib/{tkinter => }/test/test_tkinter/test_messagebox.py | 0 Lib/{tkinter => }/test/test_tkinter/test_misc.py | 0 Lib/{tkinter => }/test/test_tkinter/test_simpledialog.py | 0 Lib/{tkinter => }/test/test_tkinter/test_text.py | 0 Lib/{tkinter => }/test/test_tkinter/test_variables.py | 0 Lib/{tkinter => }/test/test_tkinter/test_widgets.py | 0 Lib/{tkinter/test => test/test_tkinter}/widget_tests.py | 0 Lib/tkinter/test/test_tkinter/__init__.py | 0 16 files changed, 0 insertions(+), 0 deletions(-) rename Lib/{tkinter/test => test/test_tkinter}/README (100%) rename Lib/{tkinter/test => test/test_tkinter}/__init__.py (100%) rename Lib/{tkinter/test => test/test_tkinter}/support.py (100%) rename Lib/{tkinter => }/test/test_tkinter/test_colorchooser.py (100%) rename Lib/{tkinter => }/test/test_tkinter/test_font.py (100%) rename Lib/{tkinter => }/test/test_tkinter/test_geometry_managers.py (100%) rename Lib/{tkinter => }/test/test_tkinter/test_images.py (100%) rename Lib/{tkinter => }/test/test_tkinter/test_loadtk.py (100%) rename Lib/{tkinter => }/test/test_tkinter/test_messagebox.py (100%) rename Lib/{tkinter => }/test/test_tkinter/test_misc.py (100%) rename Lib/{tkinter => }/test/test_tkinter/test_simpledialog.py (100%) rename Lib/{tkinter => }/test/test_tkinter/test_text.py (100%) rename Lib/{tkinter => }/test/test_tkinter/test_variables.py (100%) rename Lib/{tkinter => }/test/test_tkinter/test_widgets.py (100%) rename Lib/{tkinter/test => test/test_tkinter}/widget_tests.py (100%) delete mode 100644 Lib/tkinter/test/test_tkinter/__init__.py diff --git a/Lib/tkinter/test/README b/Lib/test/test_tkinter/README similarity index 100% rename from Lib/tkinter/test/README rename to Lib/test/test_tkinter/README diff --git a/Lib/tkinter/test/__init__.py b/Lib/test/test_tkinter/__init__.py similarity index 100% rename from Lib/tkinter/test/__init__.py rename to Lib/test/test_tkinter/__init__.py diff --git a/Lib/tkinter/test/support.py b/Lib/test/test_tkinter/support.py similarity index 100% rename from Lib/tkinter/test/support.py rename to Lib/test/test_tkinter/support.py diff --git a/Lib/tkinter/test/test_tkinter/test_colorchooser.py b/Lib/test/test_tkinter/test_colorchooser.py similarity index 100% rename from Lib/tkinter/test/test_tkinter/test_colorchooser.py rename to Lib/test/test_tkinter/test_colorchooser.py diff --git a/Lib/tkinter/test/test_tkinter/test_font.py b/Lib/test/test_tkinter/test_font.py similarity index 100% rename from Lib/tkinter/test/test_tkinter/test_font.py rename to Lib/test/test_tkinter/test_font.py diff --git a/Lib/tkinter/test/test_tkinter/test_geometry_managers.py b/Lib/test/test_tkinter/test_geometry_managers.py similarity index 100% rename from Lib/tkinter/test/test_tkinter/test_geometry_managers.py rename to Lib/test/test_tkinter/test_geometry_managers.py diff --git a/Lib/tkinter/test/test_tkinter/test_images.py b/Lib/test/test_tkinter/test_images.py similarity index 100% rename from Lib/tkinter/test/test_tkinter/test_images.py rename to Lib/test/test_tkinter/test_images.py diff --git a/Lib/tkinter/test/test_tkinter/test_loadtk.py b/Lib/test/test_tkinter/test_loadtk.py similarity index 100% rename from Lib/tkinter/test/test_tkinter/test_loadtk.py rename to Lib/test/test_tkinter/test_loadtk.py diff --git a/Lib/tkinter/test/test_tkinter/test_messagebox.py b/Lib/test/test_tkinter/test_messagebox.py similarity index 100% rename from Lib/tkinter/test/test_tkinter/test_messagebox.py rename to Lib/test/test_tkinter/test_messagebox.py diff --git a/Lib/tkinter/test/test_tkinter/test_misc.py b/Lib/test/test_tkinter/test_misc.py similarity index 100% rename from Lib/tkinter/test/test_tkinter/test_misc.py rename to Lib/test/test_tkinter/test_misc.py diff --git a/Lib/tkinter/test/test_tkinter/test_simpledialog.py b/Lib/test/test_tkinter/test_simpledialog.py similarity index 100% rename from Lib/tkinter/test/test_tkinter/test_simpledialog.py rename to Lib/test/test_tkinter/test_simpledialog.py diff --git a/Lib/tkinter/test/test_tkinter/test_text.py b/Lib/test/test_tkinter/test_text.py similarity index 100% rename from Lib/tkinter/test/test_tkinter/test_text.py rename to Lib/test/test_tkinter/test_text.py diff --git a/Lib/tkinter/test/test_tkinter/test_variables.py b/Lib/test/test_tkinter/test_variables.py similarity index 100% rename from Lib/tkinter/test/test_tkinter/test_variables.py rename to Lib/test/test_tkinter/test_variables.py diff --git a/Lib/tkinter/test/test_tkinter/test_widgets.py b/Lib/test/test_tkinter/test_widgets.py similarity index 100% rename from Lib/tkinter/test/test_tkinter/test_widgets.py rename to Lib/test/test_tkinter/test_widgets.py diff --git a/Lib/tkinter/test/widget_tests.py b/Lib/test/test_tkinter/widget_tests.py similarity index 100% rename from Lib/tkinter/test/widget_tests.py rename to Lib/test/test_tkinter/widget_tests.py diff --git a/Lib/tkinter/test/test_tkinter/__init__.py b/Lib/tkinter/test/test_tkinter/__init__.py deleted file mode 100644 index e69de29bb2d1d6..00000000000000 From 8ee5ffe744d68908b2bba40f62bfeb2c1424d95b Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Jun 2022 17:22:46 +0200 Subject: [PATCH 3/8] Add Lib/test/test_tkinter/__init__.py Remove Lib/test/test_tk.py. --- Lib/test/test_tk.py | 20 -------------------- Lib/test/test_tkinter/__init__.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 20 deletions(-) delete mode 100644 Lib/test/test_tk.py diff --git a/Lib/test/test_tk.py b/Lib/test/test_tk.py deleted file mode 100644 index 8f90cbaba9f7c4..00000000000000 --- a/Lib/test/test_tk.py +++ /dev/null @@ -1,20 +0,0 @@ -import unittest -from test import support -from test.support import import_helper -from test.support import check_sanitizer - -if check_sanitizer(address=True, memory=True): - raise unittest.SkipTest("Tests involvin libX11 can SEGFAULT on ASAN/MSAN builds") - -# Skip test if _tkinter wasn't built. -import_helper.import_module('_tkinter') - -# Skip test if tk cannot be initialized. -support.requires('gui') - -def load_tests(loader, tests, pattern): - return loader.discover('tkinter.test.test_tkinter') - - -if __name__ == '__main__': - unittest.main() diff --git a/Lib/test/test_tkinter/__init__.py b/Lib/test/test_tkinter/__init__.py index e69de29bb2d1d6..abf9297ae4cc45 100644 --- a/Lib/test/test_tkinter/__init__.py +++ b/Lib/test/test_tkinter/__init__.py @@ -0,0 +1,17 @@ +import os.path +from test import support +from test.support import import_helper + + +if support.check_sanitizer(address=True, memory=True): + raise unittest.SkipTest("Tests involvin libX11 can SEGFAULT on ASAN/MSAN builds") + +# Skip test if _tkinter wasn't built. +import_helper.import_module('_tkinter') + +# Skip test if tk cannot be initialized. +support.requires('gui') + + +def load_tests(*args): + return support.load_package_tests(os.path.dirname(__file__), *args) From 67ea5c0702900e60a1e4f8a34f5eed5f75b6c88e Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Jun 2022 17:24:02 +0200 Subject: [PATCH 4/8] Update imports --- Lib/test/test_tkinter/test_colorchooser.py | 2 +- Lib/test/test_tkinter/test_font.py | 2 +- Lib/test/test_tkinter/test_geometry_managers.py | 4 ++-- Lib/test/test_tkinter/test_images.py | 2 +- Lib/test/test_tkinter/test_messagebox.py | 2 +- Lib/test/test_tkinter/test_misc.py | 2 +- Lib/test/test_tkinter/test_simpledialog.py | 2 +- Lib/test/test_tkinter/test_text.py | 2 +- Lib/test/test_tkinter/test_variables.py | 2 +- Lib/test/test_tkinter/test_widgets.py | 4 ++-- Lib/test/test_tkinter/widget_tests.py | 2 +- Lib/test/test_ttk/test_extensions.py | 2 +- Lib/test/test_ttk/test_style.py | 2 +- Lib/test/test_ttk/test_widgets.py | 4 ++-- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Lib/test/test_tkinter/test_colorchooser.py b/Lib/test/test_tkinter/test_colorchooser.py index 488162ff0dd966..9bba21392d8d14 100644 --- a/Lib/test/test_tkinter/test_colorchooser.py +++ b/Lib/test/test_tkinter/test_colorchooser.py @@ -1,7 +1,7 @@ import unittest import tkinter from test.support import requires, swap_attr -from tkinter.test.support import AbstractDefaultRootTest, AbstractTkTest +from test.test_tkinter.support import AbstractDefaultRootTest, AbstractTkTest from tkinter import colorchooser from tkinter.colorchooser import askcolor from tkinter.commondialog import Dialog diff --git a/Lib/test/test_tkinter/test_font.py b/Lib/test/test_tkinter/test_font.py index 058c53a9023647..563707ddd2fa9b 100644 --- a/Lib/test/test_tkinter/test_font.py +++ b/Lib/test/test_tkinter/test_font.py @@ -2,7 +2,7 @@ import tkinter from tkinter import font from test.support import requires, gc_collect, ALWAYS_EQ -from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest +from test.test_tkinter.support import AbstractTkTest, AbstractDefaultRootTest requires('gui') diff --git a/Lib/test/test_tkinter/test_geometry_managers.py b/Lib/test/test_tkinter/test_geometry_managers.py index c89bc8dbf85759..3663048a145ab1 100644 --- a/Lib/test/test_tkinter/test_geometry_managers.py +++ b/Lib/test/test_tkinter/test_geometry_managers.py @@ -4,8 +4,8 @@ from tkinter import TclError from test.support import requires -from tkinter.test.support import pixels_conv -from tkinter.test.widget_tests import AbstractWidgetTest +from test.test_tkinter.support import pixels_conv +from test.test_tkinter.widget_tests import AbstractWidgetTest requires('gui') diff --git a/Lib/test/test_tkinter/test_images.py b/Lib/test/test_tkinter/test_images.py index cc69ccac62d742..b6f8b79ae689fa 100644 --- a/Lib/test/test_tkinter/test_images.py +++ b/Lib/test/test_tkinter/test_images.py @@ -2,7 +2,7 @@ import tkinter from test import support from test.support import os_helper -from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest, requires_tcl +from test.test_tkinter.support import AbstractTkTest, AbstractDefaultRootTest, requires_tcl support.requires('gui') diff --git a/Lib/test/test_tkinter/test_messagebox.py b/Lib/test/test_tkinter/test_messagebox.py index d38541a5a45e76..f41bdc98286283 100644 --- a/Lib/test/test_tkinter/test_messagebox.py +++ b/Lib/test/test_tkinter/test_messagebox.py @@ -1,7 +1,7 @@ import unittest import tkinter from test.support import requires, swap_attr -from tkinter.test.support import AbstractDefaultRootTest +from test.test_tkinter.support import AbstractDefaultRootTest from tkinter.commondialog import Dialog from tkinter.messagebox import showinfo diff --git a/Lib/test/test_tkinter/test_misc.py b/Lib/test/test_tkinter/test_misc.py index 620b6ed638c25a..d1aca58d15fbd8 100644 --- a/Lib/test/test_tkinter/test_misc.py +++ b/Lib/test/test_tkinter/test_misc.py @@ -3,7 +3,7 @@ import tkinter import enum from test import support -from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest +from test.test_tkinter.support import AbstractTkTest, AbstractDefaultRootTest support.requires('gui') diff --git a/Lib/test/test_tkinter/test_simpledialog.py b/Lib/test/test_tkinter/test_simpledialog.py index 18cd2712b0c5ed..502f7f7098a322 100644 --- a/Lib/test/test_tkinter/test_simpledialog.py +++ b/Lib/test/test_tkinter/test_simpledialog.py @@ -1,7 +1,7 @@ import unittest import tkinter from test.support import requires, swap_attr -from tkinter.test.support import AbstractDefaultRootTest +from test.test_tkinter.support import AbstractDefaultRootTest from tkinter.simpledialog import Dialog, askinteger requires('gui') diff --git a/Lib/test/test_tkinter/test_text.py b/Lib/test/test_tkinter/test_text.py index 482f150df559fc..d1583f0b20aabe 100644 --- a/Lib/test/test_tkinter/test_text.py +++ b/Lib/test/test_tkinter/test_text.py @@ -1,7 +1,7 @@ import unittest import tkinter from test.support import requires -from tkinter.test.support import AbstractTkTest +from test.test_tkinter.support import AbstractTkTest requires('gui') diff --git a/Lib/test/test_tkinter/test_variables.py b/Lib/test/test_tkinter/test_variables.py index 427e168454362c..c1d232e2febc7a 100644 --- a/Lib/test/test_tkinter/test_variables.py +++ b/Lib/test/test_tkinter/test_variables.py @@ -6,7 +6,7 @@ from tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl, TclError) from test.support import ALWAYS_EQ -from tkinter.test.support import AbstractDefaultRootTest +from test.test_tkinter.support import AbstractDefaultRootTest class Var(Variable): diff --git a/Lib/test/test_tkinter/test_widgets.py b/Lib/test/test_tkinter/test_widgets.py index fe8ecfeb326554..1cddbe17ba5207 100644 --- a/Lib/test/test_tkinter/test_widgets.py +++ b/Lib/test/test_tkinter/test_widgets.py @@ -4,10 +4,10 @@ import os from test.support import requires -from tkinter.test.support import (requires_tcl, +from test.test_tkinter.support import (requires_tcl, get_tk_patchlevel, widget_eq, AbstractDefaultRootTest) -from tkinter.test.widget_tests import ( +from test.test_tkinter.widget_tests import ( add_standard_options, AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests, setUpModule) diff --git a/Lib/test/test_tkinter/widget_tests.py b/Lib/test/test_tkinter/widget_tests.py index 8418154d64a851..85b0511aba3c7a 100644 --- a/Lib/test/test_tkinter/widget_tests.py +++ b/Lib/test/test_tkinter/widget_tests.py @@ -1,7 +1,7 @@ # Common tests for test_tkinter/test_widgets.py and test_ttk/test_widgets.py import tkinter -from tkinter.test.support import (AbstractTkTest, tcl_version, +from test.test_tkinter.support import (AbstractTkTest, tcl_version, pixels_conv, tcl_obj_eq) import test.support diff --git a/Lib/test/test_ttk/test_extensions.py b/Lib/test/test_ttk/test_extensions.py index 1220c4831c52f4..6135c49701f08e 100644 --- a/Lib/test/test_ttk/test_extensions.py +++ b/Lib/test/test_ttk/test_extensions.py @@ -3,7 +3,7 @@ import tkinter from tkinter import ttk from test.support import requires, gc_collect -from tkinter.test.support import AbstractTkTest, AbstractDefaultRootTest +from test.test_tkinter.support import AbstractTkTest, AbstractDefaultRootTest requires('gui') diff --git a/Lib/test/test_ttk/test_style.py b/Lib/test/test_ttk/test_style.py index 54ad3437168fe1..0ec95cf6b5ffc9 100644 --- a/Lib/test/test_ttk/test_style.py +++ b/Lib/test/test_ttk/test_style.py @@ -4,7 +4,7 @@ from tkinter import ttk from test import support from test.support import requires -from tkinter.test.support import AbstractTkTest, get_tk_patchlevel +from test.test_tkinter.support import AbstractTkTest, get_tk_patchlevel requires('gui') diff --git a/Lib/test/test_ttk/test_widgets.py b/Lib/test/test_ttk/test_widgets.py index c14c321ca2687d..eb0cc93ce270b5 100644 --- a/Lib/test/test_ttk/test_widgets.py +++ b/Lib/test/test_ttk/test_widgets.py @@ -5,9 +5,9 @@ import sys from test.test_ttk_textonly import MockTclObj -from tkinter.test.support import (AbstractTkTest, tcl_version, get_tk_patchlevel, +from test.test_tkinter.support import (AbstractTkTest, tcl_version, get_tk_patchlevel, simulate_mouse_click, AbstractDefaultRootTest) -from tkinter.test.widget_tests import (add_standard_options, +from test.test_tkinter.widget_tests import (add_standard_options, AbstractWidgetTest, StandardOptionsTests, IntegerSizeTests, PixelSizeTests, setUpModule) From e3ff9d518ea12458c9eb99afda320d209120eaa8 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Jun 2022 17:31:36 +0200 Subject: [PATCH 5/8] Update references --- Makefile.pre.in | 6 +-- PCbuild/lib.pyproj | 93 ++++++++++++++++++--------------------- Tools/wasm/wasm_assets.py | 13 +----- 3 files changed, 48 insertions(+), 64 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index 6448785c28070e..5d0ae6bca87445 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1987,15 +1987,15 @@ TESTSUBDIRS= distutils/tests \ test/test_lib2to3/data/fixers \ test/test_lib2to3/data/fixers/myfixes \ test/test_peg_generator \ + test/test_tkinter \ test/test_tools \ + test/test_ttk \ test/test_warnings test/test_warnings/data \ test/test_zoneinfo test/test_zoneinfo/data \ test/test_unittest test/test_unittest/testmock \ test/tracedmodules \ test/xmltestdata test/xmltestdata/c14n-20 \ - test/ziptestdata \ - tkinter/test tkinter/test/test_tkinter \ - tkinter/test/test_ttk + test/ziptestdata TEST_MODULES=@TEST_MODULES@ libinstall: all $(srcdir)/Modules/xxmodule.c diff --git a/PCbuild/lib.pyproj b/PCbuild/lib.pyproj index 2355eb5486fd7e..0556efe1a77d2b 100644 --- a/PCbuild/lib.pyproj +++ b/PCbuild/lib.pyproj @@ -1323,7 +1323,17 @@ - + + + + + + + + + + + @@ -1339,8 +1349,11 @@ - + + + + @@ -1353,7 +1366,33 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1432,22 +1471,6 @@ - - - - - - - - - - - - - - - - @@ -1490,33 +1513,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1802,16 +1798,15 @@ + + - - - diff --git a/Tools/wasm/wasm_assets.py b/Tools/wasm/wasm_assets.py index 67afde60f0942d..a59db9db7cdd20 100755 --- a/Tools/wasm/wasm_assets.py +++ b/Tools/wasm/wasm_assets.py @@ -109,11 +109,6 @@ "_zoneinfo": ["zoneinfo/"], } -# regression test sub directories -OMIT_SUBDIRS = ( - "tkinter/test/", -) - def get_builddir(args: argparse.Namespace) -> pathlib.Path: """Get builddir path from pybuilddir.txt """ @@ -136,9 +131,6 @@ def create_stdlib_zip( *, optimize: int = 0, ) -> None: - def filterfunc(name: str) -> bool: - return not name.startswith(args.omit_subdirs_absolute) - with zipfile.PyZipFile( args.wasm_stdlib_zip, mode="w", compression=args.compression, optimize=optimize ) as pzf: @@ -152,7 +144,7 @@ def filterfunc(name: str) -> bool: continue if entry.name.endswith(".py") or entry.is_dir(): # writepy() writes .pyc files (bytecode). - pzf.writepy(entry, filterfunc=filterfunc) + pzf.writepy(entry) def detect_extension_modules(args: argparse.Namespace): @@ -234,9 +226,6 @@ def main(): omit_files.extend(modfiles) args.omit_files_absolute = {args.srcdir_lib / name for name in omit_files} - args.omit_subdirs_absolute = tuple( - str(args.srcdir_lib / name) for name in OMIT_SUBDIRS - ) # Empty, unused directory for dynamic libs, but required for site initialization. args.wasm_dynload.mkdir(parents=True, exist_ok=True) From 78fc0ca24905e1165dfb470190080941f3ee5d60 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Jun 2022 17:37:54 +0200 Subject: [PATCH 6/8] Add NEWS entry --- .../next/Tests/2022-06-21-17-37-46.gh-issue-54781.BjVAVg.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2022-06-21-17-37-46.gh-issue-54781.BjVAVg.rst diff --git a/Misc/NEWS.d/next/Tests/2022-06-21-17-37-46.gh-issue-54781.BjVAVg.rst b/Misc/NEWS.d/next/Tests/2022-06-21-17-37-46.gh-issue-54781.BjVAVg.rst new file mode 100644 index 00000000000000..f7ae7b976af95b --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-06-21-17-37-46.gh-issue-54781.BjVAVg.rst @@ -0,0 +1,2 @@ +Rename test_tk to test_tkinter, and rename test_ttk_guionly to test_ttk. +Patch by Victor Stinner. From bccf79da0e6660dedee4b2a0a300700100d063b7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Jun 2022 22:15:57 +0200 Subject: [PATCH 7/8] Add __main__ sub-modules --- Lib/test/test_tkinter/__main__.py | 4 ++++ Lib/test/test_ttk/__main__.py | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 Lib/test/test_tkinter/__main__.py create mode 100644 Lib/test/test_ttk/__main__.py diff --git a/Lib/test/test_tkinter/__main__.py b/Lib/test/test_tkinter/__main__.py new file mode 100644 index 00000000000000..40a23a297ec2b4 --- /dev/null +++ b/Lib/test/test_tkinter/__main__.py @@ -0,0 +1,4 @@ +from . import load_tests +import unittest + +unittest.main() diff --git a/Lib/test/test_ttk/__main__.py b/Lib/test/test_ttk/__main__.py new file mode 100644 index 00000000000000..40a23a297ec2b4 --- /dev/null +++ b/Lib/test/test_ttk/__main__.py @@ -0,0 +1,4 @@ +from . import load_tests +import unittest + +unittest.main() From 941d3826191c864bc4d59474c47f2c63d56e503e Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Jun 2022 22:54:52 +0200 Subject: [PATCH 8/8] Add missing unittest import Fix spelling typo: involving (missing G) Remove useless "if __name__ == '__main__':" block from Lib/test/test_ttk/__init__.py: the package has a __main__.py sub-module. --- Lib/test/test_tkinter/__init__.py | 3 ++- Lib/test/test_ttk/__init__.py | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_tkinter/__init__.py b/Lib/test/test_tkinter/__init__.py index abf9297ae4cc45..edcb44951bde36 100644 --- a/Lib/test/test_tkinter/__init__.py +++ b/Lib/test/test_tkinter/__init__.py @@ -1,10 +1,11 @@ import os.path +import unittest from test import support from test.support import import_helper if support.check_sanitizer(address=True, memory=True): - raise unittest.SkipTest("Tests involvin libX11 can SEGFAULT on ASAN/MSAN builds") + raise unittest.SkipTest("Tests involving libX11 can SEGFAULT on ASAN/MSAN builds") # Skip test if _tkinter wasn't built. import_helper.import_module('_tkinter') diff --git a/Lib/test/test_ttk/__init__.py b/Lib/test/test_ttk/__init__.py index 9b054b49912e66..7ee7ffbd6d7408 100644 --- a/Lib/test/test_ttk/__init__.py +++ b/Lib/test/test_ttk/__init__.py @@ -3,6 +3,7 @@ from test import support from test.support import import_helper + if support.check_sanitizer(address=True, memory=True): raise unittest.SkipTest("Tests involving libX11 can SEGFAULT on ASAN/MSAN builds") @@ -33,9 +34,6 @@ def setUpModule(): root.destroy() del root + def load_tests(*args): return support.load_package_tests(os.path.dirname(__file__), *args) - - -if __name__ == '__main__': - unittest.main()