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.
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.
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
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..
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.
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>
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>
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>