Commit Graph

230 Commits

Author SHA1 Message Date
Takeshi KOMIYA
c6bd84a614 refactor: Remove u-prefix from strings 2018-12-16 21:28:51 +09:00
Takeshi KOMIYA
66fad4e22d Remove a hack for py2 from testcode 2018-12-15 22:01:22 +09:00
Takeshi KOMIYA
4761e70c37 Merge branch '1.8' 2018-11-22 22:14:32 +09:00
Jon Dufresne
555960d668 Deprecate and drop internal use of force_decode()
In the Python 3 only code base, this function is no longer necessary.
The type of values is well understood and deliberate. Code should avoid
arbitrary mixing of bytes & str.

By removing force_decode() calls from docstring values, can deprecate
the now unused 'encoding' arguments to various autodoc methods.
2018-11-13 07:16:39 -08:00
Takeshi KOMIYA
0ccc64d9ea test: Filter warnings on testing 2018-11-12 00:37:51 +09:00
Takeshi KOMIYA
9c4e5b244a test: Replace call_autodoc() by do_autodoc() 2018-11-11 21:22:11 +09:00
Takeshi KOMIYA
ea03286647 test: Move autodoc_missing_imports to test-ext-autodoc 2018-10-17 11:36:11 +09:00
Eric N. Vander Weele
d6b9db9581 tests: Ensure 'member-only' autodoc_default_options is respected
When specifying the 'member-only' option to `autodoc_default_options`,
ensure it is respected.
2018-10-14 20:18:59 -04:00
Takeshi KOMIYA
dc44b0d2a9 Merge branch 'master' into HEAD 2018-09-22 22:54:15 +09:00
Takeshi KOMIYA
3a2418a827 refactoring: Drop PY2 and PY3 flags 2018-09-22 21:27:59 +09:00
Takeshi KOMIYA
48c634e623 test: Merge py35/test_autodoc_py35.py to test_autodoc.py 2018-09-22 16:41:44 +09:00
Takeshi KOMIYA
b18fe13f55 Drop branches for sys.version_info < (3, 4) 2018-09-22 16:31:07 +09:00
Takeshi KOMIYA
522105b79b Merge branch '1.8' 2018-09-20 20:01:14 +09:00
Takeshi KOMIYA
c7f3933612
Merge branch '1.8' into 5431_warnings_for_callable 2018-09-18 23:34:33 +09:00
Takeshi KOMIYA
5c3a0e4e40 Fix #5431: autodoc: `autofunction` emits a warning for callable objects 2018-09-18 13:02:01 +09:00
Takeshi KOMIYA
9e8434f902 Fix #5436: Autodoc does not work with enum subclasses with properties/methods 2018-09-18 13:01:10 +09:00
Takeshi KOMIYA
6d55e98da1 test: Move EnumCls to target.enum package 2018-09-18 13:01:10 +09:00
Jon Dufresne
490e4aed41 Remove unnecessary object from class definitions
In Python 3, all classes are new-style classes. The object in the
definition is redundant and unnecessary.
2018-09-11 07:07:01 -07:00
Takeshi KOMIYA
02afc357ef Merge branch '1.8' 2018-09-09 19:26:48 +09:00
Takeshi KOMIYA
35e1764025 Fix #5290: autodoc: failed to analyze source code in egg package 2018-09-06 22:22:01 +09:00
Takeshi KOMIYA
06aa1a7864 Fix #2401: autodoc: `:members: causes :special-members:` not to be shown 2018-09-03 01:26:31 +09:00
Takeshi KOMIYA
a7cab001d9 Drop APIs deprecated in 2.0 2018-09-03 00:31:33 +09:00
Takeshi KOMIYA
e3f383ad7c
Merge pull request #5315 from tk0miya/add_autodoc_default_options
Add autodoc_default_options
2018-08-20 00:26:08 +09:00
Takeshi KOMIYA
7f52ef7512 Merge branch '1.7' 2018-08-19 02:19:06 +09:00
Takeshi KOMIYA
3d9e2cf831 Add autodoc_default_options 2018-08-18 18:22:16 +09:00
Lewis Haley
f196a92055 autodoc: add 'exclude-members' to user global options
As the previous commit explains, it is now possible to specify arguments
to the global options in config files. This means that we can now include
the `exclude-members` option in this global configuration.

Previously, there was no point including this option because it makes no
sense without arguments. Including this option means users have the
flexibility of explicitly including which special methods they want using
(e.g.):

  :special-members: __init__, __iter__

or explicitly excluding which special-members (or other members) they want
using (e.g.):

  :exclude-members: __weakref__, __hash__
2018-08-17 16:02:11 +01:00
Lewis Haley
6e1e35c98a autodoc: allow specifying values to global arguments
Previously, users could specify a *list* of flags in their config files.
The flags were directive names that would otherwise be present in the
.rst files. However, as a list, it was not possible to specify values
to those flags, which *is* possible in .rst files.

For example, in .rst you could say

  :special-members: __init__, __iter__

And this would cause autodoc to generate documents for these methods that
it would otherwise ignore.

This commit changes the config option to instead accept a dictionary.
This is a dictionary whose keys can contain the same flag-names as before,
but whose values can contain the arguments as seen in .rst files.

The old list is still supported, for backwards compatibility, but the data
is transformed into a dictionary when the user's config is loaded.
2018-08-17 15:51:00 +01:00
Lewis Haley
87029392fd test_autodoc: fix mutable function default argument in do_autodoc
Setting mutable types as default arguments is bad practice because the
value is only initialised once. This means that defaults arguments of
lists and dictionaries which are modified during code execution *stay*
modified between calls.

In this case, the `options` dictionary accumulated options as more and
more test cases were executed. Without this change, the tests added in
the next commit do not pass.

See: https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument
2018-08-17 15:33:58 +01:00
Takeshi KOMIYA
c4fa1aed34 Fix #5211: autodoc: No docs generated for functools.partial functions 2018-08-17 01:24:19 +09:00
Takeshi KOMIYA
7e546c0e0b refactor: Remove duplicated testcase 2018-08-05 08:18:21 +09:00
Takeshi KOMIYA
de73ee5902 refactor: test_autodoc 2018-08-05 08:18:21 +09:00
Takeshi KOMIYA
7ee868fb18 Add testcases for autodoc_default_flags 2018-07-28 22:37:32 +09:00
Takeshi KOMIYA
f969edfaa8 Fix flake8 violations on tests 2018-07-28 20:19:30 +09:00
Takeshi KOMIYA
c657f1c1c2 test: Validate whole of generated docs by autodoc 2018-07-28 18:46:13 +09:00
Takeshi KOMIYA
7dad01d18f test: Add do_autodoc() helper 2018-07-28 18:30:27 +09:00
Takeshi KOMIYA
8c29801f27 Close #2820: autoclass directive supports nested class 2018-07-22 01:06:17 +09:00
Takeshi KOMIYA
b1acc54cf9 Fix #5139: autodoc: Enum argument missing if it shares value with another 2018-07-15 18:53:53 +09:00
Takeshi KOMIYA
aefb3bbaaa Fix #4543: testcase for partialmethod is failed with py3.6.5 2018-04-08 21:54:00 +09:00
Takeshi KOMIYA
9e0089b252 Fix #4769: autodoc loses the first staticmethod parameter 2018-03-24 00:53:07 +09:00
Takeshi KOMIYA
049df5d5e1 test: Suppress DeprecationWarning 2018-03-20 20:27:05 +09:00
Takeshi KOMIYA
f2a23b761e Fix #4543: test for autodoc fails with python 3.5.3 2018-03-13 23:23:15 +09:00
Takeshi KOMIYA
f7027049b1 Fix flake8 violations 2018-02-19 23:20:56 +09:00
Takeshi KOMIYA
656e3be754 Fix #4539: autodoc emits warnings for partialmethods 2018-02-04 23:23:43 +09:00
Takeshi KOMIYA
295323d5aa Fix #4415: autodoc classifies inherited staticmethods as regular methods 2018-01-20 01:10:47 +09:00
Takeshi KOMIYA
cbb10d61f7 Fix #4415: autodoc classifies inherited classmethods as regular methods 2018-01-20 01:10:47 +09:00
Takeshi KOMIYA
326d7e64ce Merge branch 'master' into dont_emit_system_message_on_autodoc_warning 2018-01-08 20:19:36 +09:00
Takeshi KOMIYA
5d6413b712 Deprecate sphinx.ext.autodoc.add_documenter() and AutoDirective._register 2018-01-01 12:13:29 +09:00
Takeshi KOMIYA
f1f6ca8cc9 Merge branch 'happy_new_year' into master 2018-01-01 01:09:17 +09:00
Takeshi KOMIYA
2426cedb8b A happy new year! 2018-01-01 01:06:58 +09:00
Takeshi KOMIYA
a9efb2517a Fix flake8 violations 2017-12-23 21:21:21 +09:00
Takeshi KOMIYA
e2e907b3ee Fix broken test_autodoc 2017-12-22 00:53:53 +09:00
Takeshi KOMIYA
ffa9d48d0e
Merge branch 'master' into ignore__all__ 2017-12-22 00:28:26 +09:00
Takeshi KOMIYA
ec240614d9 test_autodoc: Separate testdata (python objects) and testcases 2017-12-21 12:12:13 +09:00
Kevin Keating
e932ff5ad2 Closes #947: autodoc now supports ignore-module-all to ignore a module's __all__ 2017-12-20 15:07:33 -05:00
Takeshi KOMIYA
7a194f5296 autodoc: Use logging module to emit warnings 2017-12-20 01:40:45 +09:00
Takeshi KOMIYA
464f94c238 deprecate formatargspec() and format_annotation() 2017-12-17 15:25:44 +09:00
Takeshi KOMIYA
00169a07e6 Merge branch 'stable' 2017-09-24 22:51:23 +09:00
Antonio Valentino
96ee24d7c1 Basic test for docstring inheritance 2017-08-19 21:52:30 +02:00
Takeshi KOMIYA
13be8e03ba Fix #3969: private instance attributes causes AttributeError 2017-07-31 22:49:04 +09:00
Takeshi KOMIYA
27637d73e1 Replace getargspec by Signature class in autodoc module 2017-06-17 18:16:41 +09:00
shimizukawa
d497d74370 refs #3458: add sphinx.testing that are moved from /tests directory. 2017-05-14 20:47:15 +09:00
Takayuki SHIMIZUKAWA
6cb582fdd3 Merge pull request #3449 from njsmith/getargspec-__wrapped__
On py3, use inspect.signature for more accurate signature calculation
2017-04-19 21:21:19 +09:00
Takeshi KOMIYA
c57e47e042 Year++ 2017-03-26 11:49:34 +09:00
Nathaniel J. Smith
678eff821f Update test to match py3's more accurate signature 2017-02-24 05:40:24 -08:00
Takeshi KOMIYA
cf2061dfad Fix flake8 violations 2017-01-26 01:13:17 +09:00
shimizukawa
561abdd164 pytest optimizatoin:
- remote using deprecated decorators
- remove gen_with_app
- remove yield testing
- remove pytest warnings
- refactoring
2017-01-08 15:14:38 +09:00
shimizukawa
5b7d237db3 pytest migration 2017-01-04 00:59:30 +09:00
Takeshi KOMIYA
61a6ca5b37 Merge branch 'stable' into 1.5-release 2016-12-03 16:25:58 +09:00
shimizukawa
3284e89991 Merge branch 'fix-attr-documenter' into stable 2016-11-24 23:55:02 +09:00
Takeshi KOMIYA
4ca84aba45 Fix #3135: `sphinx.ext.autodoc` crashes with plain Callable 2016-11-13 00:01:41 +09:00
Alex Grönholm
a1f6baaa81 Fix annotations formatting for plain typing.Callable
The typing.Callable class may be used without generic arguments, in which case it is equivalent to collections.abc.Callable.
2016-11-02 21:43:33 +02:00
Takeshi KOMIYA
b32d9a9bc7 Merge pull request #3071 from mleinart/autodoc/pass_through_decorators
Autodoc: Allow mocked module decorators to pass-through functions unchanged
2016-11-02 23:01:16 +09:00
shimizukawa
a5bdf1fdae Closes #3060: autodoc supports documentation for attributes of Enum class. Now autodoc render just the value of Enum attributes instead of Enum attribute representation. 2016-10-28 00:02:09 +09:00
Michael Leinartas
7943da9408 Add tests for mocked modules 2016-10-21 09:53:25 -05:00
shimizukawa
021974ed94 refs #2432 update for latest master 2016-10-19 01:08:07 +09:00
Takayuki SHIMIZUKAWA
340c6fb9f4 Merge pull request #2432 from agronholm/kwonlyargs
#2432 Fix unwanted * between varargs and keyword only args
2016-10-19 00:54:38 +09:00
Joost van Zwieten
099b58f7fe ext.autodoc: fix formatting instance annotations
Currently `format_annotation` fails on instances, because instances don't have
`__module__` and `__qualname__` attributes.  Defer building the
`qualified_name` of an annotation until we have established that the annotation
is a type.
2016-08-07 16:18:22 +02:00
Takeshi KOMIYA
80921b2ab8 Fix flake8 violation under tests/ 2016-06-12 00:02:11 +09:00
Alex Grönholm
0beabaf4cf Fix unwanted * between varargs and keyword only args
The * parameter must only be present when a holder for positional variable arguments is not present.
2016-04-09 17:35:32 +03:00
Takeshi KOMIYA
dca1669b2f Merge pull request #2300 from akruis/feature_autoclass_content_from__new__
Feature: enhance autoclass:: to use the docstring of __new__ if __init__ method's is missing of empty
2016-02-14 14:45:25 +09:00
Anselm Kruis
0311f33347 Feature: enhance autoclass:: to use the docstring of __new__
The method new is an alternative to __init__, but autoclass does not 
respect __new__. This commit enhances the directive autoclass:: to try
__new__ method's docstring, if __init__ method's docstring is missing or
empty.

The commit also adds tests and updates the documentation.
2016-02-05 19:09:43 +01:00
Georg Brandl
4f72bdb722 Merge branch 'stable' 2016-01-14 22:54:08 +01:00
Georg Brandl
46d7e8558e Obligatory copyright update. 2016-01-14 22:54:04 +01:00
Alberto Berti
782310039b Move py3.5 specific tests to their own file and adjust test environment 2015-11-10 03:40:48 +01:00
Alberto Berti
933ed5a50c Add a test for doc on coroutine functions and general support for async/await py3.5 syntax 2015-11-10 02:38:17 +01:00
Andrey Vlasovskikh
ef0d4e7946 Skip type hinting tests if there is a SyntaxError while importing a module with function annotations 2015-07-31 21:56:13 +03:00
Andrey Vlasovskikh
1224256341 Use 'SkipTest' from 'util' for tests 2015-07-31 21:54:01 +03:00
Andrey Vlasovskikh
dd32b7fdb2 Closes #1968: Show extended type hints for function annotations that use 'typing' module 2015-07-31 21:26:32 +03:00
Erik M. Bray
def08a206f Fix documentation of descriptor classes that have a custom metaclass
(i.e. a subclass of type).  This avoids using string comparisons to do
type checks, except in the case of the fix for #1155, since in Python 3
there really seems to be no way to export the instancemethod type, short
of using ctypes.
2015-04-09 19:09:24 -04:00
Georg Brandl
a23903d8d5 Merge branch 'stable' 2015-01-03 21:41:14 +01:00
Georg Brandl
567d52f199 all: update copyright 2015-01-03 21:36:32 +01:00
Georg Brandl
4f4d8688d5 Py3 fix. 2014-11-07 15:19:36 +01:00
Georg Brandl
bbd315b82e merge with stable 2014-11-07 15:03:06 +01:00
Georg Brandl
fa09ec000f Fix :confval:autodoc_docstring_signature not working with signatures
in class docstrings.
2014-11-07 15:01:10 +01:00
Takayuki Shimizukawa
da651089e7 fix trailing space and long line 2014-10-09 23:53:33 +09:00
Georg Brandl
d47a7587f9 Complete test suite overhaul.
* rename a few test modules to make the names more consistent

* do not copy/use Sphinx from build/ (unnecessary without 2to3)

* use a temporary dir for *all* test projects, the source tree
  will stay pristine that way  (default is tests/build)

* speed up tests by ~3x by splitting up test projects and avoiding
  rebuilds
2014-09-21 17:17:02 +02:00
Georg Brandl
2c396601bf Move env.temp_data content that might be used to resolve references to a new env.ref_context dictionary. 2014-09-20 19:15:41 +02:00
Takayuki Shimizukawa
da20c3713b merge with stable 2014-07-13 11:43:12 +09:00
Takayuki Shimizukawa
b3aa4aa81b * In autodoc, fix display of parameter defaults containing backslashes. Closes #1502 2014-07-02 00:09:11 +09:00
Takayuki Shimizukawa
0fb938ad38 * add test and code comment for pull request #157 2014-06-14 17:03:57 +09:00