Commit Graph

3454 Commits

Author SHA1 Message Date
François Freitag
6b90a63f08 Fix #6629: linkcheck: Handle rate-limiting
Follow the Retry-After header if present, otherwise use an exponential
back-off.
2020-11-25 17:34:55 +01:00
Takeshi KOMIYA
c941406415 refactor with pyupgrade
Run `pyupgrade --py3-only --keep-percent-format` to refine our code.

Note:  --keep-percent-format is required to keep translations available.
2020-11-25 01:55:30 +09:00
Takeshi KOMIYA
c941b9cb14 Merge pull request #8481 from tk0miya/8480_slots_attributes
Fix #8480: autoattribute could not create document for __slots__ attributes
2020-11-24 21:53:48 +09:00
Takeshi KOMIYA
3e9200dab4 Merge pull request #8474 from tk0miya/8360_update_warning_for_numref
Fix #8360: Update warning message for numref
2020-11-24 21:38:04 +09:00
Takeshi KOMIYA
0131f776fb Merge pull request #8475 from tk0miya/8131_too_many_redirects
Extend linkchecker GET fallback logic to handle Too Many Redirects
2020-11-23 17:16:51 +09:00
Takeshi KOMIYA
50dad211ed Fix #8480: autoattribute could not create document for __slots__ attributes 2020-11-23 15:28:53 +09:00
Takeshi KOMIYA
046c289f76 linkcheck: Add a testcase for infinite redirect loop on HEAD request 2020-11-23 01:52:44 +09:00
Takeshi KOMIYA
478a1567b6 Fix #8360: Update warning message for numref 2020-11-23 01:36:35 +09:00
Takeshi KOMIYA
9eb96d5c79 Fix #8460: autodata directive does not display the detail of TypeVars
The details are only shown when automodule directive is used.  This
allows to document them via other auto* directives.
2020-11-22 13:57:48 +09:00
Takeshi KOMIYA
24a329eebe Merge pull request #8465 from tk0miya/8460_NewType
Fix #8460: autodoc: Support custom types defined by typing.NewType
2020-11-22 13:47:39 +09:00
Takeshi KOMIYA
8bb31c7e3a Merge pull request #8469 from tk0miya/refactor_test_ext_autodoc_slots
refactor: Rename example class
2020-11-22 11:42:13 +09:00
Takeshi KOMIYA
b4d4d4e808 refactor: Rename example class 2020-11-22 03:06:03 +09:00
Takeshi KOMIYA
ad804647b5 Merge pull request #8459 from tk0miya/8452_autodoc_type_aliases_with_autodoc_typehints
Fix #8452: autodoc_type_aliases doesn't work with autodoc_typehints
2020-11-22 01:34:31 +09:00
Takeshi KOMIYA
333e7a447e Fix #8452: autodoc_type_aliases doesn't work with autodoc_typehints 2020-11-22 01:26:32 +09:00
Takeshi KOMIYA
6973888294 Support NewType as a class attribute 2020-11-21 23:56:16 +09:00
Takeshi KOMIYA
46a7ea7ada Add NewType support to typing.stringify() and restify() 2020-11-21 23:04:42 +09:00
Takeshi KOMIYA
93d6c212f7 Fix #8460: autodoc: Support custom types defined by typing.NewType
A custom type defined by typing.NewType was rendered as a function
because the generated type is a function having special attributes.
This renders it as a variable.

Note: The module name where the NewType object defined is lost on
generating it.  So it is hard to make cross-reference for these custom
types.
2020-11-21 23:04:42 +09:00
François Freitag
419e145e36 Make tests/ a Python package
Allows relative imports.
2020-11-20 19:43:02 +01:00
Takeshi KOMIYA
dcd8ff544a Fix #8443: autoattribute does not support uninitialized ivars 2020-11-20 22:39:21 +09:00
Takeshi KOMIYA
f344fff55e Fix #8443: autodata directive does not support PEP-526 ivars 2020-11-20 22:38:58 +09:00
Takeshi KOMIYA
3becd56e0e Merge branch '3.x' into 8222_novalue 2020-11-17 23:56:42 +09:00
Takeshi KOMIYA
5df381e8e0 Merge pull request #8435 from tk0miya/8434_autodoc_type_aliases_for_variables
Fix #8434: autodoc_type_aliases does not effect to variables
2020-11-17 22:42:38 +09:00
Takeshi KOMIYA
f203a15141 autodoc: Fix :no-value: option for autoattribute does not work 2020-11-17 22:40:40 +09:00
Takeshi KOMIYA
af04b64906 Merge pull request #8429 from tk0miya/refactor_test_intl
test: Merge testcases having the same name
2020-11-16 02:44:58 +09:00
Takeshi KOMIYA
b615fcca85 Merge pull request #8436 from francoisfreitag/better-certs
linkcheck: Specify subjectAltName in test self-signed certificate
2020-11-16 02:42:34 +09:00
François Freitag
3c4e1c30b1 linkcheck: Specify subjectAltName in test self-signed certificate
Clears warning:

tests/test_build_linkcheck.py::test_connect_to_selfsigned_with_tls_cacerts
tests/test_build_linkcheck.py::test_connect_to_selfsigned_with_requests_env_var
  …/venv/lib/python3.8/site-packages/urllib3/connection.py:455: SubjectAltNameWarning: Certificate for localhost has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.)
    warnings.warn(
2020-11-15 18:25:39 +01:00
Takeshi KOMIYA
44fbe9da7b Fix #8434: autodoc_type_aliases does not effect to variables 2020-11-16 02:11:15 +09:00
Takeshi KOMIYA
5d8d6275a5 Merge pull request #8423 from tk0miya/getslots
Add sphinx.util.inspect:getslots() to get __slots__ attribute
2020-11-16 02:04:42 +09:00
Takeshi KOMIYA
017698a2c6 test: Fix duplicated testcases 2020-11-16 00:07:36 +09:00
Takeshi KOMIYA
f86366a2df test: Merge testcases having the same name 2020-11-16 00:03:20 +09:00
Takeshi KOMIYA
ba496f4d92 Merge pull request #8431 from francoisfreitag/never-leak-env
tests: Always cleanup when exiting modify_env context manager
2020-11-15 20:42:24 +09:00
François Freitag
5eb74d5c8e tests: Always cleanup when exiting modify_env context manager
Previously, an exception would leave the environment changed.
2020-11-15 10:25:36 +01:00
Takeshi KOMIYA
e99e2aef15 test: Fix flake8 violations 2020-11-15 17:46:37 +09:00
Takeshi KOMIYA
21a3bd4127 refactor: Fix flake8 violations under tests/ directory 2020-11-15 17:15:40 +09:00
Takeshi KOMIYA
5676fdeb4e Rename :novalue: option to :no-value: option
According to the existing options of autodoc directives, `:novalue:`
option is now renamed to `:no-value:` option.
2020-11-15 14:20:30 +09:00
François Freitag
d453088b58 linkcheck: Prevent REQUESTS_CA_BUNDLE leak in tests
Test `test_connect_to_selfsigned_nonexistent_cert_file` serves two
purposes:
- verify the behavior when the CA bundle file path is incorrect
- flag a leak of REQUESTS_CA_BUNDLE

Assumes that test runs after
`test_connect_to_selfsigned_with_requests_env_var`. Not great, but
better than no testing.
2020-11-14 19:58:02 +01:00
Takeshi KOMIYA
bbb0ea5f12 Add sphinx.util.inspect:getslots() to get __slots__ attribute 2020-11-15 02:30:25 +09:00
Takeshi KOMIYA
a638658510 Merge pull request #8421 from francoisfreitag/test-self-signed
linkcheck: Verify behavior with self-signed certs
2020-11-14 21:15:13 +09:00
François Freitag
10e11f3133 linkcheck: Verify behavior with self-signed certs 2020-11-14 12:59:29 +01:00
François Freitag
99c8765822 linkcheck: Remove unused argument from test_invalid_ssl
Not updated after c90eef1f67.
2020-11-14 12:49:47 +01:00
François Freitag
040a1e7743 linkcheck: test invalid SSL is reported as broken
`linkcheck` logic suggests that SSL errors were originally expected to
be ignored.

Blaming the corresponding lines point to issue #3008: linkcheck to
website with self-signed certificates. That issue was fixed by commit
4c7bec6460, which ignored SSL errors.
Probably because back then, users could not specify a CA bundle.

A broken SSL certificate is a real issue, it should not be ignored.
Users wishing to ignore issues for a specific link can use the
`linkcheck_ignore` option.

The current behavior is to report the site as broken, keep it.
2020-11-12 19:58:04 +01:00
François Freitag
ce9d4c1e68 linkcheck: Rewrite headers tests without mocking
Makes the test more realistic by issuing an HTTP request.
Reduces coupling between test and the code under test.
2020-11-11 21:24:06 +01:00
François Freitag
341b98f794 linkcheck: Rewrite auth tests without mocking
Makes the test more realistic by issuing an HTTP request.
Reduces coupling between test and the code under test.
2020-11-11 21:22:59 +01:00
François Freitag
53ca608bc0 linkcheck: Test redirect following for HEAD and GET 2020-11-11 18:32:53 +01:00
François Freitag
6ea0a123c6 Rename test-linkcheck-localserver{,-anchor}
Precise the `linkcheck_anchors` option is enabled. Frees the name
`test-linkcheck-localserver` for future tests without that option.
2020-11-11 18:32:52 +01:00
Takeshi KOMIYA
386929ec0f Merge pull request #8409 from francoisfreitag/linkcheck-tests
linkcheck: Remove unused arguments from tests
2020-11-12 02:17:52 +09:00
Takeshi KOMIYA
68cc0f7e94 Merge pull request #8408 from francoisfreitag/isort
Sort imports with isort
2020-11-12 02:05:13 +09:00
François Freitag
c90eef1f67 linkcheck: Remove unused arguments from tests 2020-11-11 13:48:45 +01:00
François Freitag
0949735210 Sort imports with isort
Keep imports alphabetically sorted and their order homogeneous across
Python source files.

The isort project has more feature and is more active than the
flake8-import-order plugin.

Most issues caught were simply import ordering from the same module.
Where imports were purposefully placed out of order, tag with
isort:skip.
2020-11-11 13:19:05 +01:00
Takeshi KOMIYA
1b9099f339 test: Adjust type annotataions in python 3.10 2020-11-10 22:33:03 +09:00