Commit Graph

48 Commits

Author SHA1 Message Date
Adam Turner
801c60a873 Consistently calculate the current file's directory 2024-11-03 17:28:02 +00:00
Adam Turner
116a430cac Accept PathLike in Sphinx.add_message_catalog() 2024-10-25 22:49:51 +01:00
Adam Turner
a0fe15c00d Report GIL status in pytest 2024-10-04 16:55:39 +01:00
Adam Turner
03b9134ee0
Short-circuit HTTP requests in tests (#12772) 2024-08-12 03:49:58 +01:00
Adam Turner
d03156e078
Format `tests/` (#12760) 2024-08-11 14:58:56 +01:00
danieleades
2f9a79c3b2
Disallow implicit re-export (#12653) 2024-07-23 02:38:45 +01:00
Adam Turner
3421e5382a
Narrow `Generator[T, None, None] types to Iterator[T]` (#12241) 2024-04-09 03:26:44 +01:00
Bénédikt Tran
2df5b0a8ab
[lint] whitelist all test files except configuration and utils in tests (#12109) 2024-03-16 18:06:58 +01:00
Adam Turner
e3b613aa37 Clean up global state in SphinxTestApp 2024-01-18 23:30:22 +00:00
Adam Turner
462404cb25 Organise tests into directories 2024-01-17 03:56:35 +00:00
Matt Wozniski
43d69755df
Leverage `importlib.reload` for reloading modules (#11679)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2023-09-13 22:58:35 +01:00
Adam Turner
49d8304670
Start using `pathlib.Path and deprecate sphinx.testing.path` (#11526) 2023-07-28 00:39:12 +01:00
Jean Abou-Samra
ecfd08d325
Skip sphinx.locale.init_console when running tests (#11159)
Tests for Sphinx's CLIs, like test_apidoc, indirectly init_console to
initialize translations for Sphinx's console domain, the one with
Sphinx's log messages. This bleeds over subsequent tests by making
warnings translated. Fix this by skipping init_console when running
Sphinx's test suite.
2023-01-31 22:10:48 +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
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
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
eaf495c3c4 A happy new year! 2020-01-01 14:27:43 +09:00
Takeshi KOMIYA
55100dce26 refactor: tests/conftest.py 2019-02-07 22:14:06 +09:00
Takeshi KOMIYA
9ac06520b9 test: clear SPHINX_TEST_TEMPDIR before testing 2019-02-07 01:28:45 +09:00
Takeshi KOMIYA
ed90306ee5 Show tempdir header on testing (refs: #5902) 2019-02-01 22:36:10 +09:00
Takeshi KOMIYA
d6fc5c9095 Stop to use $SPHINX_TEST_TEMPDIR envvar
At once, we added $SPHINX_TEST_TEMPDIR to keep intermediate files of
testing to investigate the failures.  At present, we've used pytest
as a test runner.  And it keeps temporary directories of last 3
testings.  So this starts to use it instead of $SPHINX_TEST_TEMPDIR.
https://docs.pytest.org/en/latest/tmpdir.html#the-default-base-temporary-directory
2019-01-13 23:50:18 +09:00
Takayuki SHIMIZUKAWA
795b518464
Add PathComparer for testing and fix 2 test failure on Windows. (#5943)
commits are squashed.

* Add PathComparer for testing and fix 2 test failure on Windows.
* fix flake8
* add type information by f2f review. Thanks to @tk0miya!
* fix mypy, flake8 again..
2019-01-13 18:40:35 +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
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
Jon Dufresne
0137b0287a Remove dead code or '.'
The expression `os.path.dirname(__file__)` always evaluates as a truthy
value. The `or '.'` is never evaluated.
2018-11-12 14:31:29 -08:00
Takeshi KOMIYA
b18fe13f55 Drop branches for sys.version_info < (3, 4) 2018-09-22 16:31:07 +09:00
Takeshi KOMIYA
48427ae57a Improve pytest header 2018-08-26 11:28:06 +09:00
Takeshi KOMIYA
f7027049b1 Fix flake8 violations 2018-02-19 23:20:56 +09:00
Takeshi KOMIYA
795ca7a0c9 Fix #4260: autodoc: keyword only argument separator is not disappeared 2018-02-13 02:13:38 +09:00
Takeshi KOMIYA
23533e48b2 Update PYTHONWARNINGS on tox.ini to reduce meaningless warnings 2018-01-06 20:14:20 +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
Stephen Finucane
9a3ebaaff5 Resolve warning filter issues
There's an issue with 'pkgutils' and namespace packages. This has been
reported against setuptools [1], but until this is resolved, we simply
need to live with it. Ensure said warnings are filtered from tox too and
remove some unnecessary ones.

[1] https://github.com/pypa/setuptools/issues/1111

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-29 13:02:32 +00:00
Stephen Finucane
529c96a3c9 tests: Use 'pytest_sessionstart'
This is the recommended way to do pre-session configuration in pytest if
not using session fixtures [1].

With this, we're able to remove the custom 'test/run.py' script in its
entirety and run 'pytest' like everyone else does. We'll do this
separately to keep things simple.

[1] https://stackoverflow.com/a/12600154/613428

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-29 13:02:26 +00:00
Stephen Finucane
c33ecd1f8f tests: Use 'pytest_report_header'
This is the recommended way to print extra headers [1].

[1] https://docs.pytest.org/en/latest/example/simple.html#adding-info-to-test-report-header

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-29 13:02:07 +00:00
Stephen Finucane
c8d56236c9 tests: Ignore roots using 'collect_ignore'
This is slightly cleaner than how we're doing this at the moment.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-18 20:10:18 +00:00
Stephen Finucane
e243e82723 tests: Ignore tests using 'collect_ignore'
Per the pytest docs [1], this is the preferred way to ignore tests. This
necessitates removing the 'test-async' target as it no longer makes any
sense.

[1] https://docs.pytest.org/en/latest/example/pythoncollection.html

Signed-off-by: Stephen Finucane <stephen@that.guru>
2017-12-18 20:10:18 +00:00
shimizukawa
d497d74370 refs #3458: add sphinx.testing that are moved from /tests directory. 2017-05-14 20:47:15 +09:00
Takeshi KOMIYA
6d08efe2dd test: Replace app.buildername by app.builder.name 2017-03-26 17:33:56 +09:00
shimizukawa
b5530629a9 pytest: update by reviewing
* remove 'specific_srcdir' feature
* simplify 'shared_result' feature
* rename 'AppWrapper' into 'SphinxTestAppWrapperForSkipBuilding'
2017-01-09 17:41:47 +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
89e1df0bba pytest: nits 2017-01-06 23:10:52 +09:00
shimizukawa
ad6d731ecf pytest: remove unused testing feature for a while. 2017-01-05 23:36:36 +09:00
shimizukawa
5b7d237db3 pytest migration 2017-01-04 00:59:30 +09:00