Mercurial > hg-stable
changeset 51695:37f693975cbc stable
demande-import-test: use `wsgiref` instead of `telnetlib` for testing
The `telnetlib` module has been dropped in 3.13. The `wsgiref` module fit the
same purpose of being obscure and not imported yet.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 15 Oct 2024 04:33:30 +0200 |
parents | 141ed0bf72a1 |
children | cd788962c6d9 |
files | tests/test-demandimport.py |
diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-demandimport.py Mon Oct 07 19:53:24 2024 +0200 +++ b/tests/test-demandimport.py Tue Oct 15 04:33:30 2024 +0200 @@ -161,18 +161,18 @@ assert f(type(re.stderr)) == "<class '_io.TextIOWrapper'>", f(type(re.stderr)) assert f(re) == "<module 'sys' (built-in)>" -assert 'telnetlib' not in sys.modules -import telnetlib +assert 'wsgiref' not in sys.modules +import wsgiref -assert isinstance(telnetlib, _LazyModule) -assert f(telnetlib) == "<module 'telnetlib' from '?'>" +assert isinstance(wsgiref, _LazyModule) +assert f(wsgiref) == "<module 'wsgiref' from '?'>" try: - from telnetlib import unknownattr + from wsgiref import unknownattr assert False, ( 'no demandmod should be created for attribute of non-package ' - 'module:\ntelnetlib.unknownattr = %s' % f(unknownattr) + 'module:\nwsgiref.unknownattr = %s' % f(unknownattr) ) except ImportError as inst: assert rsub(r"'", '', str(inst)).startswith( @@ -189,8 +189,8 @@ # test deactivation for issue6725 -del sys.modules['telnetlib'] +del sys.modules['wsgiref'] with demandimport.deactivated(): - import telnetlib -assert telnetlib.__loader__ == telnetlib.__spec__.loader -assert telnetlib.__loader__.get_resource_reader + import wsgiref +assert wsgiref.__loader__ == wsgiref.__spec__.loader +assert wsgiref.__loader__.get_resource_reader