summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pydoc.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-108303: Move all `pydoc` related test files to new `test.test_pydoc` ↵Nikita Sobolev2024-02-131-2016/+0
| | | | package (#114506)
* gh-97959: Fix rendering of routines in pydoc (GH-113941)Serhiy Storchaka2024-02-111-32/+159
| | | | | | | | | | * Class methods no longer have "method of builtins.type instance" note. * Corresponding notes are now added for class and unbound methods. * Method and function aliases now have references to the module or the class where the origin was defined if it differs from the current. * Bound methods are now listed in the static methods section. * Methods of builtin classes are now supported as well as methods of Python classes.
* gh-64020: Deprecate pydoc.ispackage() (GH-20908)Zackery Spytz2023-12-271-2/+6
| | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-81682: Fix test failures when CPython is built without docstrings (GH-113410)Serhiy Storchaka2023-12-231-9/+19
|
* gh-112139: Add `inspect.Signature.format` and use it in `pydoc` (#112143)Nikita Sobolev2023-12-021-0/+89
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-112266: Remove `(if defined)` part from `__dict__` and `__weakref__` ↵Nikita Sobolev2023-11-191-14/+14
| | | | docstrings (#112268)
* gh-107782: Use _testcapi to test non-representable signatures (GH-109325)Serhiy Storchaka2023-09-141-2/+37
| | | | | | | | | Builtin functions and methods that have non-representable signatures today will have representable signatures yesterday, and they will become unusable for testing this feature. So we need to add special functions and methods to the _testcapi module that always have non-representable signatures.
* gh-108638: Fix tests when _stat extension is missing (#108689)Victor Stinner2023-08-311-1/+7
| | | | Fix test_inspect and test_pydoc when the _stat extension is missing. Skip tests relying on _stat when _stat is missing.
* gh-107526: Fix test_module_level_callable_unrepresentable_default (gh-108187)Dong-hee Na2023-08-211-1/+1
|
* gh-107782: Pydoc: fall back to __text_signature__ if inspect.signature() ↵Serhiy Storchaka2023-08-111-0/+54
| | | | | | | fails (GH-107786) It allows to show signatures which are not representable in Python, e.g. for getattr and dict.pop.
* gh-84805: Autogenerate signature for METH_NOARGS and METH_O extension ↵Serhiy Storchaka2023-08-111-0/+50
| | | | functions (GH-107794)
* gh-102541: Add test case for help() for non_existent_module (#106340)Kirill Podoprigora2023-07-111-1/+10
| | | | | | Test fix for when one enters, for instance, 'abd' at the 'help>' prompt. --------- Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* gh-102541: Fix Helper.help("mod") for non-existent mod (#105934)Kirill Podoprigora2023-07-011-0/+7
| | | | | | If the output arg to Helper() is a stream rather than the default None, which means 'page to stdout', the ImportError from pydoc.resolve is currently not caught in pydoc.doc. The same error is caught when output is None. --------- Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* gh-65961: Do not rely solely on `__cached__` (GH-97990)Brett Cannon2022-10-061-1/+1
| | | Make sure `__spec__.cached` (at minimum) can be used.
* gh-94318: Strip trailing spaces in pydoc text output (GH-94319)Serhiy Storchaka2022-06-271-49/+49
|
* gh-84461: Fix Emscripten umask and permission issues (GH-94002)Christian Heimes2022-06-191-0/+1
| | | | | | | | - Emscripten's default umask is too strict, see https://github.com/emscripten-core/emscripten/issues/17269 - getuid/getgid and geteuid/getegid are stubs that always return 0 (root). Disable effective uid/gid syscalls and fix tests that use chmod() current user. - Cannot drop X bit from directory.
* gh-90473: Make chmod a dummy on WASI, skip chmod tests (GH-93534)Christian Heimes2022-06-061-0/+1
| | | WASI does not have the ``chmod(2)`` syscall yet.
* gh-90473: Skip tests that don't apply to Emscripten and WASI (GH-92846)Christian Heimes2022-05-161-2/+6
|
* bpo-46998: Allow subclassing Any at runtime (GH-31841)Shantanu2022-04-051-6/+6
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-26120: do not exclude __future__ import in pydoc of the __future__ ↵Irit Katriel2022-03-291-0/+17
| | | | module itself (GH-32180)
* bpo-40280: Skip socket, fork, subprocess tests on Emscripten (GH-31986)Christian Heimes2022-03-221-1/+2
| | | | | | | | | | | - Add requires_fork and requires_subprocess to more tests - Skip extension import tests if dlopen is not available - Don't assume that _testcapi is a shared extension - Skip a lot of socket tests that don't work on Emscripten - Skip mmap tests, mmap emulation is incomplete - venv does not work yet - Cannot get libc from executable The "entire" test suite is now passing on Emscripten with EMSDK from git head (91 suites are skipped).
* bpo-40296: Fix supporting generic aliases in pydoc (GH-30253)Serhiy Storchaka2022-03-181-0/+58
|
* bpo-47042: Fix testing the HTML output in test_pydoc (GH-31959)Serhiy Storchaka2022-03-171-6/+10
| | | | | | | Previously it tested that that the actual output contains every non-whitespace character from the expected output (ignoring order and repetitions). Now it will test that the actual output contains the same lines as the expected output, in the same order, ignoring indentation and empty lines.
* General cleanup of test_pydoc (GH-29459)Zachary Ware2021-11-071-43/+43
| | | | | | | | | | | - Uniform usage of `test.support.requires_docstrings` instead of a local check for `-OO`. - Added `requires_docstrings` to a couple more methods that need it. - Replaced a few instances of `test.test_pydoc` with `__name__` to allow for different methods of running just this test file. - Rewrote `test_server` to run faster and better test the server. - Removed unused import. - Removed unused locals. - Minor whitespace cleanups.
* bpo-10716: Migrating pydoc to html5. (GH-28651)Julien Palard2021-10-091-166/+114
|
* bpo-45229: Remove test_main in many tests (GH-28405)Serhiy Storchaka2021-09-191-15/+6
| | | | | | | | | Instead of explicitly enumerate test classes for run_unittest() use the unittest ability to discover tests. This also makes these tests discoverable and runnable with unittest. load_tests() can be used for dynamic generating tests and adding doctests. setUpModule(), tearDownModule() and addModuleCleanup() can be used for running code before and after all module tests.
* bpo-45020: Freeze some of the modules imported during startup. (gh-28335)Eric Snow2021-09-151-0/+2
| | | | | | | Doing this provides significant performance gains for runtime startup (~15% with all the imported modules frozen). We don't yet freeze all the imported modules because there are a few hiccups in the build systems we need to sort out first. (See bpo-45186 and bpo-45188.) Note that in PR GH-28320 we added a command-line flag (-X frozen_modules=[on|off]) that allows users to opt out of (or into) using frozen modules. The default is still "off" but we will change it to "on" as soon as we can do it in a way that does not cause contributors pain. https://bugs.python.org/issue45020
* bpo-44967: pydoc: return non-zero exit code when query is not found (GH-27868)Gregory Anders2021-08-261-4/+12
|
* bpo-38605: Revert making 'from __future__ import annotations' the default ↵Pablo Galindo2021-04-211-2/+2
| | | | | | (GH-25490) This reverts commits 044a1048ca93d466965afc027b91a5a9eb9ce23c and 1be456ae9d53bb1cba2b24fc86175c282d1c2169, adapting the code to changes that happened after it.
* bpo-43682: Make staticmethod objects callable (GH-25117)Victor Stinner2021-04-111-1/+1
| | | Static methods (@staticmethod) are now callable as regular functions.
* bpo-43682: @staticmethod inherits attributes (GH-25268)Victor Stinner2021-04-091-2/+4
| | | | | | | | | | Static methods (@staticmethod) and class methods (@classmethod) now inherit the method attributes (__module__, __name__, __qualname__, __doc__, __annotations__) and have a new __wrapped__ attribute. Changes: * Add a repr() method to staticmethod and classmethod types. * Add tests on the @classmethod decorator.
* bpo-40066: Enum: modify `repr()` and `str()` (GH-22392)Ethan Furman2021-03-311-1/+1
| | | | | | | | | * Enum: streamline repr() and str(); improve docs - repr() is now ``enum_class.member_name`` - stdlib global enums are ``module_name.member_name`` - str() is now ``member_name`` - add HOW-TO section for ``Enum`` - change main documentation to be an API reference
* bpo-42988: Remove the pydoc getfile feature (GH-25015)Victor Stinner2021-03-291-6/+0
| | | | | | | CVE-2021-3426: Remove the "getfile" feature of the pydoc module which could be abused to read arbitrary files on the disk (directory traversal vulnerability). Moreover, even source code of Python modules can contain sensitive data like passwords. Vulnerability reported by David Schwörer.
* bpo-38605: Make 'from __future__ import annotations' the default (GH-20434)Batuhan Taskaya2020-10-061-2/+2
| | | | | The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions. For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
* bpo-40275: Use new test.support helper submodules in tests (GH-21451)Hai Shi2020-08-031-8/+7
|
* bpo-40275: Adding threading_helper submodule in test.support (GH-20263)Hai Shi2020-05-271-2/+3
|
* bpo-35113: Fix inspect.getsource to return correct source for inner classes ↵Karthikeyan Singaravelan2020-04-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#10307) * Use ast module to find class definition * Add NEWS entry * Fix class with multiple children and move decorator code to the method * Fix PR comments 1. Use node.decorator_list to select decorators 2. Remove unwanted variables in ClassVisitor 3. Simplify stack management as per review * Add test for nested functions and async calls * Fix pydoc test since comments are returned now correctly * Set event loop policy as None to fix environment related change * Refactor visit_AsyncFunctionDef and tests * Refactor to use local variables and fix tests * Add patch attribution * Use self.addCleanup for asyncio * Rename ClassVisitor to ClassFinder and fix asyncio cleanup * Return first class inside conditional in case of multiple definitions. Remove decorator for class source. * Add docstring to make the test correct * Modify NEWS entry regarding decorators * Return decorators too for bpo-15856 * Move ast and the class source code to top. Use proper Exception.
* bpo-40257: Improve help for the typing module (GH-19546)Serhiy Storchaka2020-04-181-1/+2
| | | | | | * Show docstring for special forms. * Show docstring for special generic aliases. * Show documentation for __origin__ for generic aliases.
* bpo-40257: Output object's own docstring in pydoc (GH-19479)Serhiy Storchaka2020-04-151-1/+2
|
* bpo-38614: Use test.support.SHORT_TIMEOUT constant (GH-17566)Victor Stinner2019-12-111-1/+1
| | | | | | | | | | | | | | | Replace hardcoded timeout constants in tests with SHORT_TIMEOUT of test.support, so it's easier to ajdust this timeout for all tests at once. SHORT_TIMEOUT is 30 seconds by default, but it can be longer depending on --timeout command line option. The change makes almost all timeouts longer, except test_reap_children() of test_support which is made 2x shorter: SHORT_TIMEOUT should be enough. If this test starts to fail, LONG_TIMEOUT should be used instead. Uniformize also "from test import support" import in some test files.
* bpo-38786: Add parsing of https links to pydoc (GH-17143)Kirill2019-11-131-0/+11
|
* Remove unused imports in tests (GH-14518)Victor Stinner2019-07-011-1/+0
|
* bpo-36045: builtins.help() now prefixes `async` for async functions (GH-12010)Dan Rose2019-05-241-0/+23
| | | | | | Previously, it was hard to tell whether a function should be awaited. It was also incorrect (per PEP 484) to put this in the type hint for coroutine functions. Added this info to the output of builtins.help and pydoc. https://bugs.python.org/issue36045
* bpo-36729: Delete unused text variable on tests. (GH-12959)Emmanuel Arias2019-04-291-4/+0
|
* bpo-35619: Improve support of custom data descriptors in help() and pydoc. ↵Serhiy Storchaka2019-01-151-10/+164
| | | | (GH-11366)
* bpo-32492: Tweak _collections._tuplegetter. (GH-11367)Serhiy Storchaka2018-12-311-0/+10
| | | | | | * Replace the docstrings cache with sys.intern(). * Improve tests. * Unify names of tp_descr_get and tp_descr_set functions.
* bpo-35614: Fix pydoc help() on metaclasses (#11357)Sanyam Khurana2018-12-311-0/+11
|
* bpo-35513: Replace time.time() with time.monotonic() in tests (GH-11182)Victor Stinner2018-12-171-2/+2
| | | | | | | Replace time.time() with time.monotonic() in tests to measure time delta. test_zipfile64: display progress every minute (60 secs) rather than every 5 minutes (5*60 seconds).
* bpo-34966: Improve support of method aliases in pydoc. (GH-9823)Serhiy Storchaka2018-11-081-0/+99
| | | | Pydoc now does not duplicate docstrings for aliases of inherited methods.
* bpo-8525: help() on a type now shows builtin subclasses (GH-5066)Sanyam Khurana2018-10-211-0/+118
| | | | | For builtin types with builtin subclasses, help() on the type now shows up to 4 of the subclasses. This partially replaces the exception hierarchy information previously displayed in Python 2.7.