Commit Graph

124 Commits

Author SHA1 Message Date
Adam Turner
a56fdad70b
Use `sphinx._cli.util.colour in sphinx.util.console` (#13241) 2025-01-16 16:57:28 +00:00
Adam Turner
72ce43619c
Remove unneeded runtime typing imports (#13233) 2025-01-12 01:04:14 +00:00
Adam Turner
3af48520d2 Require the PEP 563 'annotations' future import 2024-11-22 21:54:26 +00:00
Adam Turner
71c0fcfbc5
Use pathlib in the tests (#13051) 2024-10-25 22:41:08 +01:00
Adam Turner
9e1c27aca0 Enable the PLC0206 lint in Ruff 2024-10-19 01:16:07 +01:00
danieleades
7546545876
Further improve typing in tests/ (#12816)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-10-03 20:17:40 +01:00
Adam Turner
0b17bb1029
Always define the builder and `testroot when using the app` fixtureture (#12775) 2024-08-12 22:34:03 +01:00
Adam Turner
d03156e078
Format `tests/` (#12760) 2024-08-11 14:58:56 +01:00
Adam Turner
462404cb25 Organise tests into directories 2024-01-17 03:56:35 +00:00
Adam Turner
49d8304670
Start using `pathlib.Path and deprecate sphinx.testing.path` (#11526) 2023-07-28 00:39:12 +01:00
Adam Turner
18f8c0bfc8 Resolve lint errors from Ruff 0.0.254 2023-03-05 12:54:24 +00:00
Adam Turner
6c56988979 Unescape quotation marks where possible 2023-02-18 02:16:50 +00:00
Adam Turner
c8f4a03dac Fix COM812 2023-02-18 01:58:05 +00:00
Adam Turner
7fb45a9058 Enable Ruff's flake8-bandit checks 2022-12-29 23:53:48 +00:00
Adam Turner
24e3b7c8c8 .read_text() -> .read_text(encoding='utf8') 2022-04-27 03:04:19 +01:00
Adam Turner
5775912455 Collapse single line docstrings 2022-02-20 03:13:45 +00:00
Adam Turner
6bb7b891a1 Remove copyright and licence fields 2022-02-20 03:06:23 +00:00
Adam Turner
5694e0ce60 Fix module docstring indentation 2022-02-20 00:35:13 +00:00
Adam Turner
4f5a3269a6 Fix module docstring first line 2022-02-20 00:11:08 +00:00
Adam Turner
6b8bccec59 Remove module titles in docstrings 2022-02-19 23:17:29 +00:00
Takeshi KOMIYA
b84771dcd2 A happy new year! 2022-01-01 18:45:03 +09:00
Takeshi KOMIYA
c2e4820ba3 Fix a flake8 violation 2021-07-07 02:06:30 +09:00
Raymond Sun
9ff1697939 Make test more readable 2021-06-14 16:15:50 +10:00
Raymond Sun
6a9cc9e5ea Fix flake8 errors 2021-06-14 16:15:50 +10:00
Raymond Sun
81049deed6 Make quickstart just exit without reprompting 2021-06-12 00:07:34 +10:00
Raymond Sun
864a0b377d Add test 2021-06-11 23:06:03 +10:00
Takeshi KOMIYA
3059a999b2 Close #8326: Rename master_doc to root_doc
To describe the purpose more accurately, the `master_doc` is now renamed
to `root_doc`.  The old name is still available.  But it is recommeneded
to use new one from now on.
2021-02-28 17:10:57 +09:00
Takeshi KOMIYA
9ced1e355a refactor: test: Do not use deprecated function: execfile_() 2021-01-17 18:39:27 +09:00
Takeshi KOMIYA
f996859420 A happy new year!
.. note::

   $ find sphinx tests LICENSE doc/conf.py -type f -exec sed -i '' -e 's/2007\-20../2007-2021/' {} \;
   $ git co sphinx/locale/**/*.js sphinx/templates/epub3/mimetype
2021-01-01 13:40:48 +09: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
4dd8b1022f test: Use read_text() and read_bytes() 2020-02-01 11:58:51 +09:00
Takeshi KOMIYA
eaf495c3c4 A happy new year! 2020-01-01 14:27:43 +09:00
Takeshi KOMIYA
3791013c08 quickstart: Simplify generated conf.py (master_doc) 2019-02-09 15:00:27 +09:00
Takeshi KOMIYA
d4df28c643 quickstart: Simplify generated conf.py (source_suffix) 2019-02-09 15:00:27 +09:00
Takeshi KOMIYA
68c90a26f1 quickstart: Simplify generated conf.py (for latex) 2019-01-07 23:06:14 +09:00
Takeshi KOMIYA
76e9f57c2e Merge branch '1.8' 2019-01-02 16:16:25 +09:00
Takeshi KOMIYA
1b1ebd2c75 A happy new year! 2019-01-02 16:00:30 +09:00
Jon Dufresne
6978918ffc Replace use of six.text_type with str
This removes the last use of the six package allowing Sphinx to remove
it as a dependency.
2018-12-18 16:23:10 -08:00
Jon Dufresne
43ff640b58 Deprecate quickstart.term_decode() and remove internal uses
Per the Python 3 docs, input() always returns a string:

https://docs.python.org/3/library/functions.html#input

> The function then reads a line from input, converts it to a
> string (stripping a trailing newline), and returns that.

The stubs from typeshed say the same:

5c69373890/stdlib/3/builtins.pyi (L835)

Here is the implementation from CPython with also shows a call to
PyUnicode_Decode on the result:

https://github.com/python/cpython/blob/3.7/Python/bltinmodule.c#L1960-L2143

As the value is always a string, there is nothing to decode. Therefore
the call to term_decode() unnecessary and can safely be removed.

With this in mind, must adjust quickstart tests to be more
representative.
2018-12-17 06:44:17 -08:00
Jon Dufresne
bade33c7e4 Remove unnecessary encoding cookie from Python source files
In Python 3, the default encoding of source files is utf-8. The encoding
cookie is now unnecessary and redundant so remove it. For more details,
see the docs:

https://docs.python.org/3/howto/unicode.html#the-string-type

> The default encoding for Python source code is UTF-8, so you can
> simply include a Unicode character in a string literal ...

Includes a fix for the flake8 header checks to stop expecting an
encoding cookie.
2018-12-16 12:22:12 -08:00
Takeshi KOMIYA
c6bd84a614 refactor: Remove u-prefix from strings 2018-12-16 21:28:51 +09:00
Jon Dufresne
5bf25eb445 Avoid respecifying default encoding for .encode()/.decode() calls
In Python 3, both .encode() and .decode() default the encoding to
'utf-8'. See the docs:

https://docs.python.org/3/library/stdtypes.html#str.encode
https://docs.python.org/3/library/stdtypes.html#bytes.decode

Simplify and shorten the code by using the default instead of
respecifying it.
2018-12-15 17:19:56 -08:00
Takeshi KOMIYA
fd1dd13a50 refactor: Replace six.StringIO by io.StringIO 2018-12-15 21:00:38 +09:00
Takeshi KOMIYA
a5e7e85e92 quickstart: Simplify generated conf.py (for manpage) 2018-12-02 17:57:20 +09:00
Takeshi KOMIYA
e527be396a
Merge pull request #5607 from tk0miya/smart_texinfo_conf_py
quickstart: Simplify generated conf.py (for texinfo)
2018-12-02 01:30:51 +09:00
Takeshi KOMIYA
4761e70c37 Merge branch '1.8' 2018-11-22 22:14:32 +09:00
Jon Dufresne
444a7212b6 Fix "invalid escape sequence" warnings emitted during tests
sphinx/tests/test_quickstart.py:221: DeprecationWarning: invalid escape sequence '\*'
    content = filename.bytes().decode('unicode-escape')
  sphinx/tests/test_quickstart.py:221: DeprecationWarning: invalid escape sequence '\`'
    content = filename.bytes().decode('unicode-escape')
2018-11-13 07:14:24 -08:00
Takeshi KOMIYA
bdaedbcbe4 quickstart: Simplify generated conf.py (for texinfo) 2018-11-11 21:57:14 +09:00
Jon Dufresne
02d06bdaf0 Remove uses of six.moves that did not cause any type errors
Removal of the remaining imports may require passing "--python-version
3.5" to the mypy command.
2018-09-23 09:22:06 -07:00
Takeshi KOMIYA
3a2418a827 refactoring: Drop PY2 and PY3 flags 2018-09-22 21:27:59 +09:00