summaryrefslogtreecommitdiff
path: root/docutils/test/test_parsers/test_rst
Commit message (Collapse)AuthorAgeFilesLines
* Revert addition of `io.OutString` and the "auto_encode" argument.milde2023-05-021-11/+9
| | | | | | | We need a review of the "string output" interface and a consensus on the "clean" end-state before starting with the implementation. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9369 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Test syntax highlight: Make pygments version parsing more robust.milde2023-04-173-21/+10
| | | | | | | Do not fail for pre-release versions (c.f. https://pygments.org/docs/changelog/). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9355 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Support Pygments 2.14 and newer in testsmilde2023-04-173-0/+278
| | | | | | | | | Pygments 2.14 contains changes in the Python lexer which break ``test_code``​​, ``test_code_long``, and ``test_include``. https://pygments.org/docs/changelog/#version-2-14-0 git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9354 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Set "auto_encode=False" to skip en-/decoding output in tests.milde2023-04-111-3/+5
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9341 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix IndexError when running individual test modules under Python <3.9milde2022-11-2666-67/+67
| | | | | | | | | Up to Python 3.8, __file__ returns a relative path for the main script specified on the command line. Use `Path.resolve()` to make it absolute before calling `Path.parents`. https://docs.python.org/3/whatsnew/3.9.html#other-language-changes git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9277 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix import errors with ``python -m unittest``.milde2022-11-2562-63/+370
| | | | | | | | Running standard unittest on the test suite resulted in 89 ImportErrors because ``import DocutilsTestSupport was used to set up sys.path() but the module could not be found on the original sys.path(). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9274 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove spurious "import unittest" from test scripts.milde2022-11-2462-62/+0
| | | | | | | There was a "late" import if __name__ == "__main__" which is no longer required when importing `unittest` at the top. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9269 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix failure when "pygments" is not installed.milde2022-11-241-5/+10
| | | | | | | | | A name mismatch occured during the test refactoring which prevented deleting a test sample requiring "pygments". Signed-off-by: milde <milde@users.sf.net> git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9266 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Reset not only `_roles` but also `_directives` cache dictionary.milde2022-11-242-5/+43
| | | | | | | | | | | | | | | | Clean the global caches to ensure predictable test results. (There were additional warnings for undefined directive and role names under Windows. These were suppressed due to other tests adding canonical names to the cache under Linux.) Add additional warnings to the expected output samples. Registering directives at test module level no longer works. Move `register_directive()` call to the test function. Signed-off-by: milde <milde@users.sf.net> git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9265 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix running of individual test (first batch).milde2022-11-249-3/+12
| | | | | | | | | | | | | | | | | | After test refactoring, test scripts failed with ImportError unless started from the "test root" ``docutils/test/``. Prepend the "docutils root" to the Python library path so we import the local `docutils` and `test` packages, ignoring an eventually installed Docutils package. Set executable bit where this was missing. Also: Use "pathlib" instead of "os.path" for self-documenting path manipulations. Remove duplicate ``import unittest`` statements. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9263 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Make the tests agnostic to the working directoryaa-turner2022-11-106-54/+77
| | | | | | | | | | | Previously, the test suite only worked when the current working directory was ``docutils/test/`. With this change all relative paths are calculated explicitly such that the working directory no longer affects the tests, meaning a less fragile test environment and greater flexibility to use test runners other than ``alltests.py``. This is part of the test suite refactoring project. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9236 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Make ``test_include`` independent of the CWDaa-turner2022-11-091-267/+268
| | | | | | | | | Tests in ``test_include`` previously only passed when the current working directory was equal to the test root. This change makes it possible to run the tests without changing the CWD, as part of the test suite refactoring project git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9233 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline ``exception_data``aa-turner2022-11-095-21/+68
| | | | | | | - Move all usages of ``exception_data`` to using the ``try`` / ``except`` pattern as part of the test suite refactoring project git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9232 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline ``ParserTestSuite``aa-turner2022-11-0961-389/+1262
| | | | | | | - Move all usages of ``ParserTestSuite.generateTests`` to using subtests, as part of the test suite refactoring project git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9230 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline ``TransformTestSuite``aa-turner2022-11-091-11/+27
| | | | | | | | | - Move all usages of ``TransformTestSuite.generateTests`` to using subtests, as part of the test suite refactoring project - Fix the global state issues with ``test_hyperlinks_de`` and run the test as part of ``alltests.py`` git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9229 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline ``GridTableParserTestSuite``aa-turner2022-11-081-6/+35
| | | | | | | - Move all usages of ``GridTableParserTestSuite.generateTests`` to using subtests, as part of the test suite refactoring project git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9224 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline ``SimpleTableParserTestSuite``aa-turner2022-11-081-6/+19
| | | | | | | - Move all usages of ``SimpleTableParserTestSuite.generateTests`` to using subtests, as part of the test suite refactoring project git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9223 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Simplify and expand tests for handling the encoding of included files.milde2022-11-073-26/+114
| | | | | | | | | Use a simpler sample file for signed UTF-16 input. Test encoding auto-detection to ensure it is in sync with encoding handling for the main document. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9220 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Partially revert r9167aa-turner2022-11-021-1/+1
| | | | | | | | | | | | | | | | | | | | ``docutils.core.publish_string`` uses Python 2 notion of a bytestring, such that in the general case it returns Python 3's ``bytes`` type. Revision 9167 attempted to address this distinction by introducing ``publish_bytes`` and changing ``publish_string`` to always return unicode text data as Python's ``str`` type. This is a backwards compatibility break, so in this commit we restore the previous behaviour, whilst simultaneously deprecating support for returning binary data from the ``docutils.core.publish_string`` function for at least two releases of Docutils. As part of this, we also deprecate returning binary data from the ``docutils.io.StringOutput.encode`` method, docutils.io.BytesOutput`` should be used in its stead. Finally, we update tests for the reversion to the previous behaviour. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9202 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Normalise all test section namesaa-turner2022-10-2813-21/+21
| | | | | | | Ensure all names are lowercase, and replace all non-alpha characters with underscores. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9193 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix newline problems, further simplify ``compare_output``aa-turner2022-10-216-7/+13
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9169 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Simplify ``CustomTestCase.compare_output``aa-turner2022-10-211-7/+7
| | | | | | | | Ensure that the ``core.publish_string`` always returns a string, introduce ``core.publish_bytes`` for binary output. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9167 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use ``docutils.utils`` over ``DocutilsTestSupport.utils``aa-turner2022-10-213-6/+10
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9164 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Subclass directly from ``unittest.TestCase``aa-turner2022-10-211-4/+1
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9148 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove all ``import __init__`` statements, as part of theaa-turner2022-10-2165-130/+0
| | | | | | | unittest migration. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9141 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Import ``DocutilsTestSupport`` from ``test``aa-turner2022-10-2167-93/+65
| | | | | | | | | | | | This is the first step of moving to the standard ``unittest`` style. It involves making the ``test/`` directory a psuedo-package and importing the ``DocutilsTestSupport`` module from it, instead of the path manipulation previously carried out in ``__init__.py`` files. As of this, we also blank out all ``__init__.py`` files in the test directories. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9140 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Resolve flake8 ``E275`` erroraa-turner2022-10-203-4/+4
| | | | | | | E275: missing whitespace after keyword git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9127 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Code style fixes.milde2022-09-132-2/+3
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9122 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Rename `io.locale_encoding` to mark it as internal.milde2022-06-171-2/+2
| | | | | | | | | | The attribute was moved to "io" after the last release. Backwards compatibility is ensured via `locale_encoding` in the (deprecated) "utils.error_reporting" module. Fix HISTORY entries. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9078 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Ensure locale_encoding is lower case.milde2022-06-151-1/+1
| | | | | | | Use `locale.getpreferredencoding(False)` since we dropped support for older Python versions with side-effects. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9074 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Unify naming of the "utf-8" codec.milde2022-06-131-3/+4
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9068 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* New wrapper module for "CommonMark" parsers.milde2022-03-291-9/+9
| | | | | | | | | | | | | | | | | | The parser names 'commonmark' and 'markdown' now select the first locally installed parser from a list of compatible 3rd-party parser packages (pycmark, myst, and recommonmark). The parsers return slightly different doctrees. This should not matter for HTML output but leads to false negatives with the "include" directive test. Therefore the test case now specifies "recommonmark". The "pycmark" parser defines transformations to comlete nested parsing and clean up non-standard nodes. These transformations must also be run when including a document fragment. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9048 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Update PEP base URL and template.milde2022-03-131-1/+1
| | | | | | | | | | | | | | The canonical PEP base URL changed to "peps.python.org/". The PEP-writer template.txt added a "source" link that no longer works due to sources now only be stored on github and having two possible file extensions ("txt" or "rst"). Adapt the header to resemble the header of official PEP documents (which are now produced using Sphinx). Fixes [bug:#445]. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9045 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove unused imports.milde2022-03-0568-74/+67
| | | | | | flake8 rule F401 git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9037 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Do not use bare 'except'.milde2022-03-051-1/+1
| | | | | | | | | | flake8 rule E722 Exception: as catchall, if * the right thing to do does not depend on the error * any error is reported or risen again. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9033 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Ensure 2 blank lines around top-level functions and classes.milde2022-03-0465-0/+90
| | | | | | | | flake8 rules E302: expected 2 blank lines, found 1 E305: expected 2 blank lines after class or function definition git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9026 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Ensure at least two spaces before inline comment.milde2022-03-045-7/+7
| | | | | | | | | flake 8 rule E261 Exceptions for modules sheduled for removal or with 3rd-party origin and for data collections. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9021 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix missing whitespace after ',' or ':'.milde2022-03-034-4/+7
| | | | | | | | flake8 rule E231. Mostly trailing commas in list and dictionary literals. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9018 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix whitespace before/after delimiters and colon.milde2022-03-031-3/+3
| | | | | | | | | | | | | | Flake rules E201 whitespace after '(' E202 whitespace before '}' E203 whitespace before ':' E211 whitespace before '(' Exception: : as binary operator in extended slices (cf. https://www.python.org/dev/peps/pep-0008/#pet-peeves). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9015 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* More detailled import error for missing components.milde2022-02-101-1/+1
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9006 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix trailing whitespace (non-Python files).milde2022-01-292-4/+4
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8995 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix code indentationmilde2022-01-291-3/+3
| | | | | | | | | | | | | | | | | | | | Check conformance to our coding policies with flake8. Fix the following problems: E111 indentation is not a multiple of four E114 indentation is not a multiple of four (comment) E115 expected an indented block (comment) E116 unexpected indentation (comment) E117 over-indented E121 continuation line under-indented for hanging indent E122 continuation line missing indentation or outdented E124 closing bracked does not match visual indentaion E127 continuation line over-indented for visual indent E128 continuation line under-indented for visual indent E131 continuation line unaligned for hanging indent git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8994 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix trailing whitespace (flake warnings W293, W391).milde2022-01-291-1/+1
| | | | | | | W293 blank line contains whitespace W391 blank line at end of file git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8993 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix trailing whitespace (flake warning W291).milde2022-01-291-6/+6
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8992 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Various small fixes.milde2022-01-291-1/+0
| | | | | | | | | | | | Update comments One more generator expression instead of lists. Fix unbound variable. Drop duplicate import. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8990 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use generator expressions instead of lists.milde2022-01-271-3/+16
| | | | | | | | | | Based on a patch by Adam Turner. Avoid deeply nested statements as function argument. Improve readability of system message by line wrapping. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8987 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Drop string prefix "u".milde2022-01-2616-104/+104
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8983 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove unused importsmilde2022-01-264-4/+0
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8979 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Small fixes and clean-ups by Adam Turner.milde2022-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Remove duplicate definitions in language modules. Import locale_encoding from `docutils.io` Use decorator for staticmethod Use True/False over 1/0. `collections.OrderedDict` no longer required, all dictionaries are ordered from Python 3.7 Remove obsolete `__cmp__` method cf. https://docs.python.org/3/whatsnew/3.0.html#ordering-comparisons Use str instead of type(''). Zero-argument ``super()`` Simplify test support module as "u" prefix isn't used by repr in Python 3. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8973 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use generator expressions with functions expecting a sequence.milde2022-01-261-6/+6
| | | | | | Based on patches by Adam Turner git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8970 929543f6-e4f2-0310-98a6-ba3bd3dd1d04