summaryrefslogtreecommitdiff
path: root/docutils/test/DocutilsTestSupport.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix import errors with ``python -m unittest``.milde2022-11-251-13/+0
| | | | | | | | 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
* Make the tests agnostic to the working directoryaa-turner2022-11-101-3/+2
| | | | | | | | | | | 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
* Inline ``exception_data``aa-turner2022-11-091-13/+0
| | | | | | | - 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-091-59/+0
| | | | | | | - 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-102/+0
| | | | | | | | | - 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-081-34/+0
| | | | | | | - 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-081-21/+0
| | | | | | | - 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-081-22/+0
| | | | | | | - 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-081-57/+0
| | | | | | | - 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-28/+0
| | | | | | | - 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-081-40/+0
| | | | | | | | | | | - 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
* 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
* Partially revert r9167aa-turner2022-11-021-2/+3
| | | | | | | | | | | | | | | | | | | | ``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-281-77/+0
| | | | 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-281-3/+3
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9194 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Compare dictionaries directlyaa-turner2022-10-281-13/+2
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9192 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
* 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
* Remove ``DocutilsTestSupport.DevNull``aa-turner2022-10-281-13/+2
| | | | 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
* Fix flake8 errors ``E127`` and ``F401``aa-turner2022-10-211-1/+0
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9174 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Standardise test case enumerationaa-turner2022-10-211-20/+14
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9173 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Inline ``dictname`` argumentaa-turner2022-10-211-16/+15
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9172 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use ``assertEqual`` directlyaa-turner2022-10-211-13/+9
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9170 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Fix newline problems, further simplify ``compare_output``aa-turner2022-10-211-5/+2
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9169 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use ``.rstrip()`` insteadaa-turner2022-10-211-3/+2
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9168 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Simplify ``CustomTestCase.compare_output``aa-turner2022-10-211-9/+6
| | | | | | | | 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
* Remove ``run_in_debugger``aa-turner2022-10-211-87/+17
| | | | | | | To debug a specific test, use the facilities provided by ``unittest`` git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9166 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Simplify ``CustomTestCase``aa-turner2022-10-211-32/+16
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9165 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Resolve flake8 ``F401`` error in ``DocutilsTestSupport``aa-turner2022-10-211-1/+0
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9158 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Change handling of ``suite_settings``aa-turner2022-10-211-11/+7
| | | | | | | | In ``CustomTestCase``, pass ``suite_settings`` directly to ``test_case_class`` rather than altering ``kwargs``. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9156 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Use new-style ``super()``aa-turner2022-10-211-4/+4
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9154 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* ``package_unittest.debug`` is always ``False``aa-turner2022-10-211-4/+4
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9151 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Subclass directly from ``unittest.TestCase``aa-turner2022-10-211-10/+2
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9148 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Normalise imports in ``DocutilsTestSupport``aa-turner2022-10-211-13/+7
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9147 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove now unused ``_format_str`` functionaa-turner2022-10-211-40/+0
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9145 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Change working directory once for all testsaa-turner2022-10-211-3/+0
| | | | | | | | | The working directory is set to ``testroot`` in the initialisation of ``DocutilsTestSupport``, meaning we do not need to set it to the same directory in each test. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9144 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove method redefinitions in ``StandardTestCase``aa-turner2022-10-211-23/+1
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9143 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Prepare switch from optparse to argparse.milde2022-03-171-8/+4
| | | | | | | | | | | | | New interface function: frontend.get_default_settings() easy access to default settings for programmatic use. Add deprecation warnings. Catch them when accessing the deprecated functions from Docutils. Make docstrings conform to the Documentation Policies (first line: summary, next line empty). git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9047 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove unused imports.milde2022-03-051-4/+4
| | | | | | flake8 rule F401 git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9037 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Avoid line break after binary operator.milde2022-03-051-3/+3
| | | | | | | | | Breaking before binary operators is the recommended style in PEP 8 (changed in April 2016). flake8 rule W504 git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9035 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
* Avoid too long lines.milde2022-03-051-4/+4
| | | | | | flake8 rule E501: line too long (N > 79 characters) git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9030 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Ensure 2 blank lines around top-level functions and classes.milde2022-03-041-0/+2
| | | | | | | | 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-041-3/+3
| | | | | | | | | 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 around operator.milde2022-03-031-4/+4
| | | | | | | | | | | | | | flake8 rules E225: missing whitespace around operator E226: missing whitespace around arithmetic operator E228: missing whitespace around modulo operator Keep ignoring the latter two rules: PEP8 limits the recommendation to "operators with lowest priority" "if operators with different priorities are used". flake8 also flags top level operators. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@9017 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* New style classes no longer need to inherit from `object`.milde2022-01-261-1/+1
| | | | | | Patch by Adam Turner. git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8984 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
* Remove unused importsmilde2022-01-261-1/+0
| | | | git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk@8979 929543f6-e4f2-0310-98a6-ba3bd3dd1d04