summaryrefslogtreecommitdiff
path: root/docutils/test
Commit message (Collapse)AuthorAgeFilesLines
...
* Use "pathlib.Path" for self-documenting path manipulations.milde2022-11-242-18/+28
| | | | | | | | Also, use Unicode literals for Umlauts. Signed-off-by: milde <milde@users.sf.net> git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9268 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Make "record_dependecies" test independent of the working dir.milde2022-11-241-57/+60
| | | | | | | | | | | | | | | In rST, the location of images and figures is specified as URI and used literally. As a consequence, finding a corresponding image file in the local filesystem depends on the current working directory. The tests are designed to work if the cwd is the test root. As only files that are actually found are written to the "dependencies", we disable the tests for image file registry if cwd != test root. Also, use "pathlib.Path" for simpler path manipulations. Signed-off-by: milde <milde@users.sf.net> git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9267 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-243-8/+52
| | | | | | | | | | | | | | | | 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
* Skip individual "recommonmark" tests if "recommonmark" is missing.milde2022-11-2414-56/+156
| | | | | | | | Skipping the complete test directory does not work with "alltests.py". Also fix running the individual tests scripts. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9264 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix running of individual test (first batch).milde2022-11-2414-13/+52
| | | | | | | | | | | | | | | | | | 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
* Put `first` and `second` arguments of `assertEqual` on the top line.milde2022-11-241-6/+4
| | | | | | | | | When a test fails, only the first line of the failing statement is printed. Writing the statements that should be equal just behind the function name, we can see which argument is the actual "output" and which is the "expected" value if the assertment fails. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9262 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use boolean values for boolean settings.milde2022-11-181-5/+5
| | | | | | This fixes a leftover from the times Python did not have a `bool` datatype. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9257 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Drop default settings from individual functional test files.milde2022-11-1634-886/+295
| | | | | | | | | Define common defaults for all functional tests in `test_functional.py`. Only specify settings that differ from the default/fallback value in the individual test files. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9249 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Refactor HTMLTranslator initialization and parts setup.milde2022-11-1322-52/+53
| | | | | | | | | | | | | | | | | Use utils.xml_declaration(). Don't write charset (encoding) declaration if the intended output encoding is not known. Copy "meta" part content into "head" in `depart_document()` (i.e. after collecting all items). Obsoletes auxiliary method `add_meta()`. Remove it. Changes to the HTML output (no space character before closing tag of XML declaration, order of metadata elements) don't affect the HTML semantics, styling, and rendering. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9240 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* New function utils.xml_declaration()milde2022-11-131-0/+18
| | | | | | | | | Return XML text declaration. Include an encoding declaration if the intended encoding is known. Used in XML (and soon also in HTML) writer. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9239 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Add support for ``pytest``aa-turner2022-11-102-0/+24
| | | | | | | | | | | | This is the minimal configuration required for the test suite to pass using the pytest framework. This is part of the test suite refactoring project. - Ignore two classes that start with the word "Test" - Provide the standard test header to pytest - Update the documentation git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9237 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Make the tests agnostic to the working directoryaa-turner2022-11-1019-128/+243
| | | | | | | | | | | 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
* Fix/complement publisher documentation and tests.milde2022-11-101-0/+22
| | | | | | | | | | | | | | | | | | | | | | | API documentation: - Spell out ampersand (&) as "and". - Finish description of part "pepnum". - Add links to LaTeX templates. - Remove trailing whitespace. Docstrings: - Clarify source and output data type for functions using "string I/O" (with "string" in the general sense of "`str` or `bytes`"). - Recommend using publish_parts() to get Docutils output as `str`. - Add "()" to functions so that pydoc HTML rendering generates auto-links. - Add links to the HTML documentation. Tests: - Add test for input/output data types of publish_string(). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9235 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline ``DocutilsTestSupport.testroot``aa-turner2022-11-094-22/+16
| | | | | | | | | - Move all usages of ``testroot`` to defining and using a ``TEST_ROOT`` constant within the module, as part of the test suite refactoring project - Avoid ``os.chdir`` calls within ``test_error_reporting`` git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9234 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-096-34/+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
* Remove unused classes from ``DocutilsTestSupport``aa-turner2022-11-091-157/+0
| | | | | | | This removes the now unused ``StandardTestCase``, ``CustomTestCase``, and ``CustomTestSuite``. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9231 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline ``ParserTestSuite``aa-turner2022-11-0962-448/+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-0924-381/+724
| | | | | | | | | - 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 ``WriterPublishTestCase``aa-turner2022-11-083-114/+47
| | | | | | | - Move all usages of ``WriterPublishTestCase`` to using subtests, as part of the test suite refactoring project. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9228 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline ``PublishTestSuite``aa-turner2022-11-088-117/+329
| | | | | | | - Move all usages of ``PublishTestSuite.generateTests`` to using subtests, as part of the test suite refactoring project git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9227 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove unused imports in ``DocutilsTestSupport``aa-turner2022-11-081-4/+2
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9226 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline ``PEPParserTestSuite``aa-turner2022-11-083-34/+43
| | | | | | | - Move all usages of ``PEPParserTestSuite.generateTests`` to using subtests, as part of the test suite refactoring project git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9225 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline ``GridTableParserTestSuite``aa-turner2022-11-082-63/+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-082-34/+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
* Inline ``RecommonmarkParserTestSuite``aa-turner2022-11-0816-138/+274
| | | | | | | | | | | - Move all usages of ``RecommonmarkParserTestSuite.generateTests`` to using subtests. - Move the conditional test skipping logic to ``__init__.py`` in ``test_recommonmark``, and move the missing module test from ``test_recommonmark.test_misc`` to ``test_get_parser_class``, as otherwise the test would never run. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9222 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
* Simplify/fix LaTeX character encoding handling.milde2022-11-0613-14/+0
| | | | | | | | | | | Do not call "inputenc" if the "output-encoding" setting is 'utf-8'. (UTF-8 is the default encoding for LaTeX2e since 2018.) Do not call "inputenc" if the "output-encoding" setting is 'unicode': Docutils returns a `str` instance and does not know which encoding will be used when the output is written to a file or passed to LaTeX. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9219 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Don't use pseudo-encoding "unicode" for test_publish().milde2022-11-061-2/+6
| | | | | | | | | While setting "output-encoding" to "unicode" ensures that core.publish_string() returns a `str` instance, it has also effects an eventual encoding declaration (XML, HTML, LaTeX) and character conversions (LaTeX). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9218 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use the built-in ``open`` instead of ``FileInput``aa-turner2022-11-031-3/+2
| | | | | | | | This simplifies logic to use the standard ``open`` function, and simultaneously refactors usages to the context manager protocol for more explicit resource management git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9208 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* test_manpage: add docinfo to man headergrubert2022-11-031-0/+28
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9205 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* remove version control Id linegrubert2022-11-031-1/+0
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9204 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix: testoutput for optional 5th .TH argumentgrubert2022-11-031-9/+9
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9203 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Partially revert r9167aa-turner2022-11-0210-17/+37
| | | | | | | | | | | | | | | | | | | | ``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
* Separate HTML 5 test definitions from HTML 4aa-turner2022-10-283-84/+118
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9195 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use f-strings in the ``PublishPartsTestCase`` classesaa-turner2022-10-282-8/+6
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9194 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Normalise all test section namesaa-turner2022-10-2818-34/+34
| | | | | | | 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
* Compare dictionaries directlyaa-turner2022-10-283-266/+208
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9192 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use f-strings in HTML 4 and HTML 5 template testsaa-turner2022-10-283-38/+39
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9191 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Make ``Html5PublishPartsTestSuite`` independent of HTML 4aa-turner2022-10-281-3/+17
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9190 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline test case class variablesaa-turner2022-10-281-14/+8
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9189 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Report sub-tests individually in the test summaryaa-turner2022-10-281-1/+11
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9188 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Export fewer modules from ``DocutilsTestSupport``aa-turner2022-10-281-25/+8
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9187 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Do not import unused moduleaa-turner2022-10-281-1/+0
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9186 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove ``DocutilsTestSupport.DevNull``aa-turner2022-10-282-14/+5
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9185 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Standardise ``self.addTestCase`` call sitesaa-turner2022-10-281-10/+9
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9184 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Refactor ``test_language``aa-turner2022-10-281-199/+85
| | | | | | | - Use subtests - Use standard ``unittest`` assert methods git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9183 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove ``_test_more`` supportaa-turner2022-10-273-64/+20
| | | | | | | This was only used in one test and complicated the functional testing logic. Testing extra items should be done in independent tests. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9182 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use subtests for the functional testsaa-turner2022-10-271-145/+78
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9181 929543f6-e4f2-0310-98a6-ba3bd3dd1d04