You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
(5) |
May
(27) |
Jun
(22) |
Jul
(72) |
Aug
(82) |
Sep
(86) |
Oct
(138) |
Nov
(100) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(122) |
Feb
(147) |
Mar
(92) |
Apr
(82) |
May
(101) |
Jun
(153) |
Jul
(37) |
Aug
(34) |
Sep
(46) |
Oct
(46) |
Nov
(6) |
Dec
(38) |
2004 |
Jan
(64) |
Feb
(81) |
Mar
(36) |
Apr
(194) |
May
(329) |
Jun
(272) |
Jul
(68) |
Aug
(74) |
Sep
(150) |
Oct
(57) |
Nov
(62) |
Dec
(63) |
2005 |
Jan
(78) |
Feb
(30) |
Mar
(137) |
Apr
(78) |
May
(54) |
Jun
(122) |
Jul
(72) |
Aug
(110) |
Sep
(80) |
Oct
(75) |
Nov
(125) |
Dec
(79) |
2006 |
Jan
(100) |
Feb
(15) |
Mar
(41) |
Apr
(67) |
May
(30) |
Jun
(11) |
Jul
(14) |
Aug
(22) |
Sep
(20) |
Oct
(14) |
Nov
(11) |
Dec
(15) |
2007 |
Jan
(17) |
Feb
(16) |
Mar
(35) |
Apr
(21) |
May
(33) |
Jun
(50) |
Jul
(12) |
Aug
(7) |
Sep
(2) |
Oct
(6) |
Nov
(5) |
Dec
(2) |
2008 |
Jan
(14) |
Feb
(20) |
Mar
(35) |
Apr
(9) |
May
(57) |
Jun
(21) |
Jul
(42) |
Aug
(4) |
Sep
(13) |
Oct
(76) |
Nov
(40) |
Dec
(55) |
2009 |
Jan
(26) |
Feb
(15) |
Mar
(3) |
Apr
(67) |
May
(32) |
Jun
(39) |
Jul
(59) |
Aug
(31) |
Sep
(59) |
Oct
(64) |
Nov
(21) |
Dec
(10) |
2010 |
Jan
(21) |
Feb
(3) |
Mar
(116) |
Apr
(33) |
May
(9) |
Jun
(28) |
Jul
(21) |
Aug
(23) |
Sep
(146) |
Oct
(70) |
Nov
(31) |
Dec
(57) |
2011 |
Jan
(33) |
Feb
(22) |
Mar
(11) |
Apr
(21) |
May
(51) |
Jun
(47) |
Jul
(35) |
Aug
(26) |
Sep
(25) |
Oct
(34) |
Nov
(61) |
Dec
(51) |
2012 |
Jan
(75) |
Feb
(31) |
Mar
(26) |
Apr
(16) |
May
(24) |
Jun
(24) |
Jul
(31) |
Aug
(46) |
Sep
(36) |
Oct
(28) |
Nov
(37) |
Dec
(21) |
2013 |
Jan
(16) |
Feb
(56) |
Mar
(31) |
Apr
(44) |
May
(45) |
Jun
(29) |
Jul
(38) |
Aug
(18) |
Sep
(12) |
Oct
(16) |
Nov
(21) |
Dec
(11) |
2014 |
Jan
(13) |
Feb
(14) |
Mar
(28) |
Apr
(7) |
May
(72) |
Jun
(33) |
Jul
(21) |
Aug
(1) |
Sep
(6) |
Oct
(14) |
Nov
(18) |
Dec
(22) |
2015 |
Jan
(23) |
Feb
(108) |
Mar
(76) |
Apr
(114) |
May
(60) |
Jun
(9) |
Jul
(8) |
Aug
(9) |
Sep
(42) |
Oct
(9) |
Nov
|
Dec
(7) |
2016 |
Jan
(6) |
Feb
(15) |
Mar
(7) |
Apr
|
May
(33) |
Jun
(3) |
Jul
(19) |
Aug
(12) |
Sep
(6) |
Oct
(16) |
Nov
(17) |
Dec
(125) |
2017 |
Jan
(66) |
Feb
(98) |
Mar
(29) |
Apr
(32) |
May
(63) |
Jun
(98) |
Jul
(26) |
Aug
(33) |
Sep
(19) |
Oct
(77) |
Nov
(31) |
Dec
(27) |
2018 |
Jan
(32) |
Feb
(11) |
Mar
(5) |
Apr
(12) |
May
(4) |
Jun
(9) |
Jul
(9) |
Aug
(13) |
Sep
(11) |
Oct
(6) |
Nov
(23) |
Dec
(2) |
2019 |
Jan
(26) |
Feb
(12) |
Mar
(20) |
Apr
(18) |
May
(7) |
Jun
(22) |
Jul
(81) |
Aug
(129) |
Sep
(32) |
Oct
(18) |
Nov
(11) |
Dec
(44) |
2020 |
Jan
(19) |
Feb
(10) |
Mar
(38) |
Apr
(4) |
May
(9) |
Jun
(15) |
Jul
(29) |
Aug
(79) |
Sep
(12) |
Oct
(22) |
Nov
(10) |
Dec
(37) |
2021 |
Jan
(16) |
Feb
(14) |
Mar
(20) |
Apr
(100) |
May
(21) |
Jun
(19) |
Jul
(13) |
Aug
(13) |
Sep
(37) |
Oct
(112) |
Nov
(64) |
Dec
(22) |
2022 |
Jan
(209) |
Feb
(38) |
Mar
(11) |
Apr
(10) |
May
(55) |
Jun
(104) |
Jul
(35) |
Aug
(10) |
Sep
(21) |
Oct
(21) |
Nov
(50) |
Dec
(12) |
2023 |
Jan
(6) |
Feb
|
Mar
(3) |
Apr
(41) |
May
(48) |
Jun
(9) |
Jul
(6) |
Aug
(25) |
Sep
(3) |
Oct
(22) |
Nov
(56) |
Dec
(12) |
2024 |
Jan
(5) |
Feb
(5) |
Mar
(38) |
Apr
(62) |
May
(12) |
Jun
(10) |
Jul
(3) |
Aug
(59) |
Sep
(2) |
Oct
(36) |
Nov
(14) |
Dec
(3) |
2025 |
Jan
(5) |
Feb
(19) |
Mar
(7) |
Apr
(65) |
May
(11) |
Jun
(13) |
Jul
(46) |
Aug
(14) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Günter M. <mi...@us...> - 2022-11-30 13:00:37
|
- **status**: open --> open-accepted - **Comment**: With [r9237] the test-suite refactoring patch is committed to the repository. Thanks for the work. --- ** [patches:#190] Move to native `unittest`** **Status:** open-accepted **Group:** None **Created:** Thu Jan 20, 2022 01:10 AM UTC by Adam Turner **Last Updated:** Mon Jan 31, 2022 06:38 PM UTC **Owner:** nobody From FR81 https://sourceforge.net/p/docutils/feature-requests/81/#fc55/3d8d by Günter Milde > I had a quick look and the work looks promising, so yes, I would like to > give it a try. > > What is the effect on the test time and on the output if there are, e.g., > differences between output and expected in functional tests? > > To avoid wasted work (and the sunken-cost fallacy), I propose to split > the project into smaller changesets (of 1 to ca. 7 commits) which we can > discuss and adapt before pushing to origin/master and then move to the > next step. > I expect some rounds of discussion per step, so there is no > need to invest heavily in polishing in the first round. > A link to a patch that I can apply with git am -3 to a local branch > would be fine. > The discussion could move to docutils-develop or a new ticket, > whatever you prefer. This is the proposed tracking issue for moving to native unittest A --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/patches/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/patches/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: Guenter M. <mi...@us...> - 2022-11-29 13:28:54
|
Dear Docutils developers, I suggest the following change to the "Docutils Project Policies": diff --git a/docutils/docs/dev/policies.txt b/docutils/docs/dev/policies.txt index f46c143d2..6be340155 100644 --- a/docutils/docs/dev/policies.txt +++ b/docutils/docs/dev/policies.txt @@ -110,8 +110,7 @@ Documentation Conventions * Docutils documentation is written using reStructuredText, of course. -* Use 7-bit ASCII if at all possible, and Unicode substitutions when - necessary. +* The encoding of the documentation files is UTF-8. * Use the following section title adornment styles:: Rationale: Adapt the Policies to the state of the art in 2022: * Unicode and UTF-8 are now mainstream, no longer an obstacle to easy viewing and editing of the source files. * Unicode substitutions, while 7-bit ASCII save, are harder to read and understand than literal Unicode characters. The use of substitutions for "exotic" characters that are hard to reach at the keyboard or missing in many fixed-width fonts is up to the discretion of the individual authors/editors. .. include:: <isolat1.txt> G|uuml|nter |
From: Guenter M. <mi...@us...> - 2022-11-29 13:02:58
|
Dear Adam, dear Docutils developers, On 2022-11-16, Adam Turner wrote: > Dear Günter, >> the commit r9245 eliminates the deliberate distinction between Python >> object names [...] and filenames or code examples (marked up as >> "inline literal"). > I suggest documenting this in a comment at the start of the HISTORY > file, as the distinction was entirely lost on me. We might also > consider using explicit markup for clarity (either ``:title:``, or a > custom code role ``:py:``). How about the following patch? Günter >From bd20669aa778e936dcaeebf56c5dae1e3d32c136 Mon Sep 17 00:00:00 2001 From: milde <mi...@us...> Date: Tue, 29 Nov 2022 13:10:48 +0100 Subject: [PATCH] Mark up object names in HISTORY with a custom default role. Define "name" role in HISTORY, make it the default role and use it for package, module, class, function, method, and attribute names. The default default role ("title-reference") is still available as ":title:`Title of a creative work`". Define and use a CSS sheet with a rule for the custom role. Provisional: name and style of the new role may be adapted. --- docutils/HISTORY.txt | 3 +++ docutils/docs/docutils-documentation.css | 24 ++++++++++++++++++++++++ docutils/docutils.conf | 5 +++-- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 docutils/docs/docutils-documentation.css diff --git a/docutils/HISTORY.txt b/docutils/HISTORY.txt index 5bd4b91e2..63f7bc45c 100644 --- a/docutils/HISTORY.txt +++ b/docutils/HISTORY.txt @@ -1,4 +1,7 @@ .. include:: docs/header0.txt +.. role:: name +.. default-role:: name + ================== Docutils History diff --git a/docutils/docs/docutils-documentation.css b/docutils/docs/docutils-documentation.css new file mode 100644 index 000000000..6b1ca93e5 --- /dev/null +++ b/docutils/docs/docutils-documentation.css @@ -0,0 +1,24 @@ +/* Style sheet for the HTML5 output of Docutils. */ +/* */ +/* :Author: Günter Milde */ +/* :Id: $Id$ */ +/* :Copyright: © 2022 Günter Milde. */ +/* :License: Released under the `2-Clause BSD license`_, in short: */ +/* */ +/* Copying and distribution of this file, with or without modification, */ +/* are permitted in any medium without royalty provided the copyright */ +/* notice and this notice are preserved. */ +/* */ +/* This file is offered as-is, without any warranty. */ +/* */ +/* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */ + +/* This CSS3 stylesheet defines rules for the Docutils documentation pages */ + +/* Inline markup for names of classes, functions, modules, and packages. */ +span.name {color: maroon;} + +/* More contrasting background for literal text */ +.literal-block, .doctest, span.literal { + background-color: #e5f3f3; +} diff --git a/docutils/docutils.conf b/docutils/docutils.conf index b03a39dbc..c1d73baac 100644 --- a/docutils/docutils.conf +++ b/docutils/docutils.conf @@ -13,12 +13,13 @@ stylesheet-path: docutils/writers/html4css1/html4css1.css field-name-limit: 20 [html5 writer] -stylesheet-dirs: docutils/writers/html5_polyglot/ -stylesheet-path: minimal.css, responsive.css +stylesheet-dirs: docutils/writers/html5_polyglot, docs +stylesheet-path: minimal.css, responsive.css, docutils-documentation.css section-self-link: yes table-style: colwidths-grid # Prevent tools/buildhtml.py from processing certain text files. [buildhtml application] +writer: html5 ignore: GPL2.txt:header.txt:header2.txt:cheatsheet.txt prune: .svn:.hg:docs/.svn:docutils:test:tools:licenses:build:dist -- 2.30.2 |
From: Guenter M. <mi...@us...> - 2022-11-28 14:01:00
|
Dear Adam, dear Docutils developers, an update on the test suite refactoring: On 2022-11-19, Guenter Milde via Docutils-develop wrote: > On 2022-11-10, Adam Turner via Docutils-develop wrote: > >> With [r9237] the test-suite refactoring project is complete -- using >> `pytest` and `python -m unittest` now work "out-of-the-box". > > Thank you for picking up the large project of modernising and > "disentangling" the Docutils test suite. ... > # ./alltests.py > [...] > Ran 1739 tests in 5.053s ... > #> pytest-3 --quiet . ... > 369 passed, 2 skipped, 621 warnings in 6.50s > > * Only 369 out of 1739 tests reported by "alltests.py" are reported. > Is this different counting or does pytest miss more than half of the tests? > * The warnings do not show up when testing with `alltest.py` > It seems `pytest` bypasses this and reports anyway?? Fortunately, the report does not stand in the way, so we can leave this as-is. > #> python3.9 -m unittest . ... > ValueError: Empty module name I could fix the import errors, now I get:: Ran 377 tests in 5.045s 377 << 1739, missing coverage or different counting? > > The "nose" test framework fails, too:: Fixed but also not all test are found:: > nosetests3 .........................S.......................................... ---------------------------------------------------------------------- Ran 68 tests in 0.320s OK (SKIP=1) > Running idividual test files should work now as well (I did not test all of them, though). Günter |
From: Guenter M. <mi...@us...> - 2022-11-28 13:44:16
|
On 2022-11-22, Guenter Milde via Docutils-develop wrote: > trying the test suite on an installation without recommonmark, I stumbled > about a new problem: > Traceback (most recent call last): > File "/usr/local/src/docutils-git-svn/docutils/test/test_parsers/test_recommonmark/__init__.py", line 14, in <module> > import recommonmark > ModuleNotFoundError: No module named 'recommonmark' > During handling of the above exception, another exception occurred: > Traceback (most recent call last): > […] > File "/usr/local/src/docutils-git-svn/docutils/test/test_parsers/test_recommonmark/__init__.py", line 17, in <module> > raise unittest.SkipTest(f'Cannot test "{md_parser}". ' > unittest.case.SkipTest: Cannot test "recommonmark". Parser not found. > It seems raising SkipTest is only applicable for test run through the > unittest framework (where I am not sure all test run). Fixed in r9264. |
From: Guenter M. <mi...@us...> - 2022-11-22 14:05:48
|
Dear Adam, trying the test suite on an installation without recommonmark, I stumbled about a new problem: Traceback (most recent call last): File "/usr/local/src/docutils-git-svn/docutils/test/test_parsers/test_recommonmark/__init__.py", line 14, in <module> import recommonmark ModuleNotFoundError: No module named 'recommonmark' During handling of the above exception, another exception occurred: Traceback (most recent call last): […] File "/usr/local/src/docutils-git-svn/docutils/test/test_parsers/test_recommonmark/__init__.py", line 17, in <module> raise unittest.SkipTest(f'Cannot test "{md_parser}". ' unittest.case.SkipTest: Cannot test "recommonmark". Parser not found. It seems raising SkipTest is only applicable for test run through the unittest framework (where I am not sure all test run). Günter |
From: Guenter M. <mi...@us...> - 2022-11-19 15:59:30
|
Dear Adam, On 2022-11-10, Adam Turner via Docutils-develop wrote: > With [r9237] the test-suite refactoring project is complete -- using > `pytest` and `python -m unittest` now work "out-of-the-box". Thank you for picking up the large project of modernising and "disentangling" the Docutils test suite. I did not manage to review all the patches line by line but skimmed them and gave the tests a testing: Run all test tests from the ``test`` directory:: #> cd REPO-ROOT/docutils/test Now testing with different methods:: # ./alltests.py [...] Ran 1739 tests in 5.053s OK (skipped=2) Elapsed time: 5.210 seconds * All tests run. * Test reporting (in case of failures) seems OK. * Some diffs only show up after adding ``maxDiff = None`` to the test class definition. :: #> pytest-3 --quiet . [...] =============================== warnings summary =============================== test/test_settings.py::HelperFunctionsTests::test_make_paths_absolute [...] test/test_settings.py::HelperFunctionsTests::test_validate_url_trailing_slash /usr/local/src/docutils-git-svn/docutils/test/test_settings.py:246: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later. self.option_parser = frontend.OptionParser( test/test_settings.py: 612 warnings /usr/lib/python3.9/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later. option = self.option_class(*args, **kwargs) -- Docs: https://docs.pytest.org/en/stable/warnings.html 369 passed, 2 skipped, 621 warnings in 6.50s * Only 369 out of 1739 tests reported by "alltests.py" are reported. Is this different counting or does pytest miss more than half of the tests? * The warnings show up despite explicit silencing in the code. (Except when we explicitely test for them.) It seems `pytest` bypasses this and reports anyway?? * ``docs/dev/testing.txt`` suggests ``pytest --quiet ./test`` which fails if the cwd is ``docutils/test`` as suggested by the preceding:: From a shell do [#]_:: cd docutils/test python -u alltests.py I suggest:: - For the pytest_ test framework, from a shell run:: + For the pytest_ test framework:: - pytest --quiet ./test + pytest --quiet . Next the standard Python way:: #> python3.9 -m unittest . Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/usr/lib/python3.9/unittest/__main__.py", line 18, in <module> main(module=None) File "/usr/lib/python3.9/unittest/main.py", line 100, in __init__ self.parseArgs(argv) File "/usr/lib/python3.9/unittest/main.py", line 147, in parseArgs self.createTests() File "/usr/lib/python3.9/unittest/main.py", line 158, in createTests self.test = self.testLoader.loadTestsFromNames(self.testNames, File "/usr/lib/python3.9/unittest/loader.py", line 220, in loadTestsFromNames suites = [self.loadTestsFromName(name, module) for name in names] File "/usr/lib/python3.9/unittest/loader.py", line 220, in <listcomp> suites = [self.loadTestsFromName(name, module) for name in names] File "/usr/lib/python3.9/unittest/loader.py", line 154, in loadTestsFromName module = __import__(module_name) ValueError: Empty module name :( The "nose" test framework fails, too:: #> nosetests3 ====================================================================== FAIL: test_parser (test.test_parsers.test_rst.test_directives.test_admonitions_de.ParserTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/src/docutils-git-svn/docutils/test/test_parsers/test_rst/test_directives/test_admonitions_de.py", line 37, in test_parser self.assertEqual(output, case_expected) AssertionError: '<doc[27 chars] <system_message level="1" line="1" source=[358 chars]n.\n' != '<doc[27 chars] <admonition classes="admonition-admonition[105 chars]n.\n' <document source="test data"> - <system_message level="1" line="1" source="test data" type="INFO"> - <paragraph> - No directive entry for "admonition" in module "docutils.parsers.rst.languages.de". - Using English fallback for directive "admonition". <admonition classes="admonition-admonition"> <title> Admonition <paragraph> This is a generic admonition. ====================================================================== FAIL: test_parser (test.test_parsers.test_rst.test_directives.test_admonitions_dummy_lang.ParserTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/local/src/docutils-git-svn/docutils/test/test_parsers/test_rst/test_directives/test_admonitions_dummy_lang.py", line 32, in test_parser self.assertEqual(output, case_expected) AssertionError: '<doc[115 chars] <system_message level="1" line="3" source=[274 chars]).\n' != '<doc[115 chars] <attention>\n <paragraph>\n [40 chars]).\n' <document source="test data"> <attention> <paragraph> directive with silly localised name. - <system_message level="1" line="3" source="test data" type="INFO"> - <paragraph> - No directive entry for "Attention" in module "local_dummy_lang". - Using English fallback for directive "Attention". <attention> <paragraph> English fallback (an INFO is written). ---------------------------------------------------------------------- Ran 79 tests in 0.642s FAILED (SKIP=1, failures=2) Running idividual test files:: #> python3 test_error_reporting.py Traceback (most recent call last): File "/usr/local/src/docutils-git-svn/docutils/test/test_error_reporting.py", line 32, in <module> from test import DocutilsTestSupport # NoQA: F401 ImportError: cannot import name 'DocutilsTestSupport' from 'test' (/usr/lib/python3.9/test/__init__.py) Its a "chicken or egg" problem: the only remaining code in ``DocutilsTestSupport.py`` is adding the "docutils root" and the "test root" to sys.path. However, it can only be imported if "test" is recognized as package. The solution is inlining the path-modification if scripts are directly started, e.g. ~~~ diff --git a/docutils/test/test_writers/test_html4css1_template.py b/docutils/test/test_writers/test_html4css1_template.py index 4113dd443..f771506a4 100755 --- a/docutils/test/test_writers/test_html4css1_template.py +++ b/docutils/test/test_writers/test_html4css1_template.py @@ -8,11 +8,16 @@ Tests for the HTML writer. """ +from pathlib import Path import os import platform +import sys import unittest -from test import DocutilsTestSupport # NoQA: F401 +if __name__ == '__main__': + # prepend the "docutils root" to the Python library path + # so we import the local `docutils` and `test` packages, + sys.path.insert(0, str(Path(__file__).parents[2])) import docutils from docutils.core import publish_string ~~~ For scripts in the "test root", replace ``parents[2]`` with ``parents[1]`` For deeper nested scripts like docutils/test/test_parsers/test_rst/test_block_quotes.py replace ``parents[2]`` with ``parents[3]`` Also, if importing "unittest" at the top of the file, there is no need to repeat this at the end ~~~ diff --git a/docutils/test/test_parsers/test_rst/test_block_quotes.py b/docutils/test/test_parsers/test_rst/test_block_quotes.py index 4c21e8112..521caf874 100755 --- a/docutils/test/test_parsers/test_rst/test_block_quotes.py +++ b/docutils/test/test_parsers/test_rst/test_block_quotes.py @@ -8,9 +8,14 @@ Tests for states.py. """ +from pathlib import Path +import sys import unittest -from test import DocutilsTestSupport # NoQA: F401 +if __name__ == '__main__': + # prepend the "docutils root" to the Python library path + # so we import the local `docutils` and `test` packages, + sys.path.insert(0, str(Path(__file__).parents[3])) from docutils.frontend import get_default_settings from docutils.parsers.rst import Parser @@ -396,5 +401,4 @@ Paragraph. if __name__ == '__main__': - import unittest unittest.main() ~~~ When inlining the sys.path modification also in "alltests.py", DocutilsTestSupport.py should become redundant. I did not catch whether the adding of the "test root" is actually required anywhere, though. Have a nice weekend, Günter |
From: Guenter M. <mi...@us...> - 2022-11-17 23:41:20
|
On 2022-11-16, Adam Turner wrote: > Dear Günter, >> the commit r9245 eliminates the deliberate distinction between Python >> object names (up to r9244 marked up with the default "title-reference" >> role, not *emphasis*!) and filenames or code examples (marked up as >> "inline literal"). > Thank you for the clarification. > I suggest documenting this in a comment at the start of the HISTORY > file, as the distinction was entirely lost on me. We might also > consider using explicit markup for clarity (either ``:title:``, or a > custom code role ``:py:``). My main intention is to keep it simple and keep it readable in source format. The `default role`__ should be used for the most common inline text role, IMV this is `title`__ (alias "title-reference" alias "t"). The "title" role creates a `title_reference`__ element which is written in HTML as <cite>. The `MDN documentation`__ says "The <cite> HTML element is used to describe a reference to a cited creative work, and must include the title of that work." Under that assumption that "title" and "name" are synonyms and Python objects (classes, functions, ...) are a "creative work", using the default default-role is justifiable. __ https://docutils.sourceforge.io/docs/ref/rst/directives.html#setting-the-default-interpreted-text-role __ https://docutils.sourceforge.io/docs/ref/rst/roles.html#title-reference __ https://docutils.sourceforge.io/docs/ref/doctree.html#title-reference __ https://developer.mozilla.org/en-US/docs/Web/HTML/Element/cite > For programme names, such as "pandoc", "flake8", and "2to3", what > syntax would we use? Following the rule outlined in your note, these > would use literal syntax, I believe, though I would like to check > before reverting a reversion. Computer programs are listed as examples for a "creative work" in the HTML standard https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-cite-element Whether they should use the default "title" or the "literal" role depends on the context: If referencing the program by its name, use the "title" role, e.g., "we use `flake8` to check coding style". As part of an CLI call (code or kbd), use "literal" (as this is simpler as "code"), e.g., "check styling with ``flake8 myfile.py``. (I often used single backticks here as well) > There are some Python names that were previously using literal syntax > that should likely be modified, e.g. "HTMLTranslator.topic_classes", > "use_latex_toc", "split_escaped_whitespace", etc. > Finally, for expressions in the HISTORY file (e.g. "parts['title']", > "footnote_backlinks==False", etc), what syntax should we use? These are rather code snippets than names of creative work, so `literal`__ is fine (and simpler as ":code:`parts['title']`"). __ https://docutils.sourceforge.io/docs/ref/rst/roles.html#literal Günter |
From: Guenter M. <mi...@us...> - 2022-11-17 22:57:57
|
Dear Adam, On 2022-11-16, Adam Turner wrote: > Since Python 3.3 (PEP 393), all Python builds have support for the full > range of Unicode, and hence there are no longer "wide" and "narrow" > builds. > As such, I propose the patch below to remove "wide" from > ``generate_punctuation_chars.py``. Thank you for the patch. > Note this is API preserving as the > resulting "delimiters" string remains the same (the difference is that > it is now a constant rather than the concatenation of two strings). I updated "punctuation_chars.py" accordingly. I also fixed r9253, as DOUBLE LOW-REVERSED-9 QUOTATION MARK is used as quote in Old Hungarian together with ‟. (I found out after studying your reference https://www.unicode.org/L2/L2012/12168r-n4268r-oldhungarian.pdf#page=26 Realizing that Old Hungarian is written right to left (with lines top to bottom), the pairing quotes in the sample text became clear. Once at it, and looking for a solution to the non-matching quote characters, I did a complete revision of "generate_punctuation_chars.py" (see below). Günter ------ docutils/docutils/utils/punctuation_chars.py | 29 ++-- docutils/tools/dev/generate_punctuation_chars.py | 169 ++++++++++++----------- 2 files changed, 97 insertions(+), 101 deletions(-) diff --git a/docutils/docutils/utils/punctuation_chars.py b/docutils/docutils/utils/punctuation_chars.py index 161dbd60f..dfbc3dc3e 100644 --- a/docutils/docutils/utils/punctuation_chars.py +++ b/docutils/docutils/utils/punctuation_chars.py @@ -13,8 +13,6 @@ # ``docutils/tools/dev/generate_punctuation_chars.py``. # :: -import sys - """Docutils character category patterns. Patterns for the implementation of the `inline markup recognition rules`_ @@ -86,22 +84,24 @@ delimiters = ( '\ufe50-\ufe52\ufe54-\ufe58\ufe5f-\ufe61\ufe63\ufe68\ufe6a' '\ufe6b\uff01-\uff03\uff05-\uff07\uff0a\uff0c-\uff0f\uff1a' '\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65' + '\U00010100\U00010101\U0001039f\U000103d0\U00010857' + '\U0001091f\U0001093f\U00010a50-\U00010a58\U00010a7f' + '\U00010b39-\U00010b3f\U000110bb\U000110bc\U000110be-' + '\U000110c1\U00012470-\U00012473' ) -if sys.maxunicode >= 0x10FFFF: # "wide" build - delimiters += ( - '\U00010100\U00010101\U0001039f\U000103d0\U00010857' - '\U0001091f\U0001093f\U00010a50-\U00010a58\U00010a7f' - '\U00010b39-\U00010b3f\U000110bb\U000110bc\U000110be-' - '\U000110c1\U00012470-\U00012473' - ) closing_delimiters = r'\\.,;!?' # Matching open/close quotes # -------------------------- +# Matching open/close pairs are at the same position in +# `punctuation_chars.openers` and `punctuation_chars.closers`. +# Additional matches (due to different typographic conventions +# in different languages) are stored in `quote_pairs`. + quote_pairs = { - # open char: matching closing characters # usage example + # open char: matching closing characters # use case '\xbb': '\xbb', # » » Swedish '\u2018': '\u201a', # ‘ ‚ Albanian/Greek/Turkish '\u2019': '\u2019', # ’ ’ Swedish @@ -115,14 +115,7 @@ quote_pairs = { def match_chars(c1, c2): - """Test whether `c1` and `c2` are a matching open/close character pair. - - Matching open/close pairs are at the same position in - `punctuation_chars.openers` and `punctuation_chars.closers`. - The pairing of open/close quotes is ambiguous due to different - typographic conventions in different languages, - so we test for additional matches stored in `quote_pairs`. - """ + """Test whether `c1` and `c2` are a matching open/close character pair.""" try: i = openers.index(c1) except ValueError: # c1 not in openers diff --git a/docutils/tools/dev/generate_punctuation_chars.py b/docutils/tools/dev/generate_punctuation_chars.py index da5fd9e87..13de40f03 100755 --- a/docutils/tools/dev/generate_punctuation_chars.py +++ b/docutils/tools/dev/generate_punctuation_chars.py @@ -55,8 +55,6 @@ module_template = r'''# :Id: $Id$ # ``docutils/tools/dev/generate_punctuation_chars.py``. # :: -import sys - """Docutils character category patterns. Patterns for the implementation of the `inline markup recognition rules`_ @@ -86,16 +84,19 @@ import sys %(openers)s %(closers)s %(delimiters)s -if sys.maxunicode >= 0x10FFFF: # "wide" build -%(delimiters_wide)s closing_delimiters = r'\\.,;!?' # Matching open/close quotes # -------------------------- +# Matching open/close pairs are at the same position in +# `punctuation_chars.openers` and `punctuation_chars.closers`. +# Additional matches (due to different typographic conventions +# in different languages) are stored in `quote_pairs`. + quote_pairs = { - # open char: matching closing characters # usage example + # open char: matching closing characters # use case '\xbb': '\xbb', # » » Swedish '\u2018': '\u201a', # ‘ ‚ Albanian/Greek/Turkish '\u2019': '\u2019', # ’ ’ Swedish @@ -104,19 +105,14 @@ quote_pairs = { '\u201e': '\u201c\u201d', # „ “ German, „ ” Polish '\u201d': '\u201d', # ” ” Swedish '\u203a': '\u203a', # › › Swedish + '\u301d': '\u301f' # 〝 〟 CJK punctuation + '\u2e42': '\u201F', # ⹂ ‟ Old Hungarian (right to left) } """Additional open/close quote pairs.""" def match_chars(c1, c2): - """Test whether `c1` and `c2` are a matching open/close character pair. - - Matching open/close pairs are at the same position in - `punctuation_chars.openers` and `punctuation_chars.closers`. - The pairing of open/close quotes is ambiguous due to different - typographic conventions in different languages, - so we test for additional matches stored in `quote_pairs`. - """ + """Test whether `c1` and `c2` are a matching open/close character pair.""" try: i = openers.index(c1) except ValueError: # c1 not in openers @@ -136,13 +132,12 @@ def match_chars(c1, c2): # :: unicode_punctuation_categories = { - # 'Pc': 'Connector', # not used in Docutils inline markup recognition - 'Pd': 'Dash', - 'Ps': 'Open', - 'Pe': 'Close', - 'Pi': 'Initial quote', # may behave like Ps or Pe depending on usage - 'Pf': 'Final quote', # may behave like Ps or Pe depending on usage - 'Po': 'Other' + 'Pd': 'dash', + 'Ps': 'open', + 'Pe': 'close', + 'Pi': 'initial quote', # may behave like Ps or Pe depending on language + 'Pf': 'final quote', # may behave like Ps or Pe depending on language + 'Po': 'other' } """Unicode character categories for punctuation""" @@ -191,30 +186,42 @@ def character_category_patterns(): # Rearange the lists to ensure matching characters at the same # index position. - # low quotation marks are also used as closers (e.g. in Greek) - # move them to category Pi: + # LOW-9 QUOTATION MARKs are categorized as Ps (open) without matching Pe. + # They are used as initial quotes in German and final quotes in Greek. + # Remove them to get balanced Ps/Pe pairs. ucharlists['Ps'].remove('‚') # 201A SINGLE LOW-9 QUOTATION MARK ucharlists['Ps'].remove('„') # 201E DOUBLE LOW-9 QUOTATION MARK - ucharlists['Pi'] += ['‚', '„'] - - ucharlists['Pi'].remove('‛') # 201B … HIGH-REVERSED-9 QUOTATION MARK - ucharlists['Pi'].remove('‟') # 201F … HIGH-REVERSED-9 QUOTATION MARK - ucharlists['Pf'] += ['‛', '‟'] - - # 301F LOW DOUBLE PRIME QUOTATION MARK misses the opening pendant: - ucharlists['Ps'].insert(ucharlists['Pe'].index('\u301f'), '\u301d') - - # 2E42 DOUBLE LOW-REVERSED-9 QUOTATION MARK has no pair, and the only - # usages identified thus far are in old hungarian, where it doesn't seem to - # be used as a quoting character. Remove from openers (Ps) for now, for - # simplicity. + # + # HIGH-REVERSED-9 QUOTATION MARKs are categorized as Pi (initial quote) + # without matching Pf (final quote). + # Insert the LOW-9 QUOTATION MARKs at the "empty slots" in Pf. + ucharlists['Pf'].insert(ucharlists['Pi'].index('‛'), '‚') + ucharlists['Pf'].insert(ucharlists['Pi'].index('‟'), '„') + + # '⹂' 2E42 DOUBLE LOW-REVERSED-9 QUOTATION MARK + # is categorized as Ps (open) without matching Pe (close). + # It is used in Old Hungarian (written right to left) as quoting character + # matching DOUBLE HIGH-REVERSED-9 QUOTATION MARK. # https://www.unicode.org/L2/L2012/12168r-n4268r-oldhungarian.pdf#page=26 - ucharlists['Ps'].remove('⹂') + # + # '⹂' 301F LOW DOUBLE PRIME QUOTATION MARK + # is categorized as Pe (close) without matching Ps (open). + # Move to the place matching 2E42: + ucharlists['Pe'].remove('\u301f') + ucharlists['Pe'].insert(ucharlists['Ps'].index('⹂'), '\u301f') + + # check for balanced lists: + if len(ucharlists['Ps']) != len(ucharlists['Pe']): + print('Missmatch between "Open" and "Close" categories') + print(''.join(ucharlists['Ps'])) + print(''.join(ucharlists['Pe'])) + raise AssertionError + if len(ucharlists['Pi']) != len(ucharlists['Pf']): + print('Missmatch between "initial quote" and "final quote" categories') + print(''.join(ucharlists['Pi'])) + print(''.join(ucharlists['Pf'])) + raise AssertionError - # print(''.join(ucharlists['Ps']).encode('utf-8') - # print(''.join(ucharlists['Pe']).encode('utf-8') - # print(''.join(ucharlists['Pi']).encode('utf-8') - # print(''.join(ucharlists['Pf']).encode('utf-8') # The Docutils character categories # --------------------------------- @@ -245,14 +252,6 @@ def character_category_patterns(): closing_delimiters)] -def separate_wide_chars(s): - """Return (s1,s2) with characters above 0xFFFF in s2""" - maxunicode_narrow = 0xFFFF - l1 = [ch for ch in s if ord(ch) <= maxunicode_narrow] - l2 = [ch for ch in s if ord(ch) > maxunicode_narrow] - return ''.join(l1), ''.join(l2) - - def mark_intervals(s): """Return s with shortcut notation for runs of consecutive characters @@ -281,6 +280,7 @@ def mark_intervals(s): def wrap_string(s, startstring="(", endstring=" )", wrap=71): """Line-wrap a unicode string literal definition.""" + s = s.encode('unicode-escape').decode() c = len(startstring) left_indent = ' '*(c - len(startstring.lstrip(' '))) line_start_string = f"\n {left_indent}'" @@ -299,17 +299,21 @@ def wrap_string(s, startstring="(", endstring=" )", wrap=71): def print_differences(old, new, name): """List characters missing in old/new.""" if old != new: - print('new %s:' % name) - for c in new: - if c not in old: - print(' %04x'%ord(c), c, unicodedata.name(c)) - print('removed %s:' % name) - for c in old: - if c not in new: - print(' %04x'%ord(c), unicodedata.name(c)) + print(f'"{name}" changed') + if '-' in old or '-' in new: + print('-', old) + print('+', new) + else: + for c in new: + if c not in old: + print('+ %04x'%ord(c), c, unicodedata.name(c)) + for c in old: + if c not in new: + print('- %04x'%ord(c), c, unicodedata.name(c)) + return True else: - print('%s unchanged' % name) - + print(f'"{name}" unchanged') + return False # Output # ------ @@ -322,7 +326,8 @@ if __name__ == '__main__': parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('-t', '--test', action="store_true", help='test for changed character categories') - parser.add_argument('-o', '--out') + parser.add_argument('--pairs', action="store_true", + help='show openers/closers in human readable form') args = parser.parse_args() # (Re)create character patterns @@ -332,18 +337,11 @@ if __name__ == '__main__': (o, c, d, cd) = character_category_patterns() -# Characters in the upper plane require a "wide" build:: - - o, o_wide = separate_wide_chars(o) - c, c_wide = separate_wide_chars(c) - d, d_wide = separate_wide_chars(d) - # delimiters: sort and use shortcut for intervals (saves ~150 characters) # (`openers` and `closers` must be verbose and keep order # because they are also used in `match_chars()`):: d = d[:5] + mark_intervals(d[5:]) - d_wide = mark_intervals(d_wide) # Test: compare module content with re-generated definitions @@ -363,16 +361,27 @@ if __name__ == '__main__': ' module\n and a regeneration based on Unicode version %s:' % unicodedata.unidata_version) - print_differences(openers, o, 'openers') - if o_wide: - print('+ openers-wide = r"""%s"""' % o_wide.encode('utf-8')) - print_differences(closers, c, 'closers') - if c_wide: - print('+ closers-wide = r"""%s"""' % c_wide.encode('utf-8')) - - print_differences(delimiters, d + d_wide, 'delimiters') + delta_o = print_differences(openers, o, 'openers') + delta_c = print_differences(closers, c, 'closers') + print_differences(delimiters, d, 'delimiters') print_differences(closing_delimiters, cd, 'closing_delimiters') + if delta_o or delta_c: + print('\nChanges in "openers" and/or "closers",' + '\nCheck open/close pairs with option "--pairs"!') + sys.exit() + + +# Print debugging output +# ~~~~~~~~~~~~~~~~~~~~~~ +# +# Print comparison of `openers` and `closers` in human readable form +# to allow checking for matching pairs. + + if args.pairs: + for o_i, c_i in zip(o, c): + print(o_i, c_i, + unicodedata.name(o_i), '\t', unicodedata.name(c_i)) sys.exit() # Print re-generation of the punctuation_chars module @@ -386,15 +395,9 @@ if __name__ == '__main__': substitutions = { 'python_version': sys.version.split()[0], 'unidata_version': unicodedata.unidata_version, - 'openers': wrap_string(o.encode('unicode-escape').decode(), - startstring="openers = ("), - 'closers': wrap_string(c.encode('unicode-escape').decode(), - startstring="closers = ("), - 'delimiters': wrap_string(d.encode('unicode-escape').decode(), - startstring="delimiters = ("), - 'delimiters_wide': wrap_string( - d_wide.encode('unicode-escape').decode(), - startstring=" delimiters += (") + 'openers': wrap_string(o, startstring="openers = ("), + 'closers': wrap_string(c, startstring="closers = ("), + 'delimiters': wrap_string(d, startstring="delimiters = ("), } print(module_template % substitutions, end='') |
From: engelbert g. <gr...@us...> - 2022-11-17 11:59:36
|
- **status**: open --> closed-duplicate - **Comment**: patch #199 --- ** [bugs:#462] setuptools deprecates installing packages as data files** **Status:** closed-duplicate **Created:** Wed Nov 16, 2022 02:47 PM UTC by Karolina Surma **Last Updated:** Wed Nov 16, 2022 02:47 PM UTC **Owner:** nobody There is a warning emitted when building docutils 0.19 with setuptools 65.5.1. It points out three packages: - 'docutils.writers.s5_html.themes' - 'docutils.parsers.rst.include' - 'docutils.writers.s5_html.themes.default' The full warning text: ``` /usr/lib/python3.11/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning: Installing 'docutils.parsers.rst.include' as data is deprecated, please list it in `packages`. !! ############################ # Package would be ignored # ############################ Python recognizes 'docutils.parsers.rst.include' as an importable package, but it is not listed in the `packages` configuration of setuptools. 'docutils.parsers.rst.include' has been automatically added to the distribution only because it may contain data files, but this behavior is likely to change in future versions of setuptools (and therefore is considered deprecated). Please make sure that 'docutils.parsers.rst.include' is included as a package by using the `packages` configuration field or the proper discovery methods (for example by using `find_namespace_packages(...)`/`find_namespace:` instead of `find_packages(...)`/`find:`). You can read more about "package discovery" and "data files" on setuptools documentation page. ``` --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: Guenter M. <mi...@us...> - 2022-11-16 22:50:50
|
Dear Adam, dear Docutils developers, On 2022-11-13, Adam Turner wrote: >> * `output-encoding`__ is a *general* setting defined as >> "The text encoding for output". This raises the expectation that all >> Docutils output "has" the specified encoding ... >> * The behaviour of `publish_string()` has been stable for many years. >> Long-time users are familiar with it and expect it to remain stable. > There are 1283 projects published on PyPI that depend on Docutils. I > have gone through each of these projects, there are 35 (2.7%) that use > the ``docutils.core.publish_string`` function. > Of those: > * 8 set ``'output_encoding': 'unicode'``, so would be unaffected by the > eventual change to return strings. (traitsui, odoo-tools, CodeChat, > benchmarkstt, pyfda, pyretis, anna, resplendent) > * 14 use the "UTF-8" encoding and call ``.decode()`` straight after, so > would have to refactor but want to use Python strings. > (Orange-Canvas-Core, galaxy-util, vb2py, gluetool, madgui, pydoc-fork, > ScopeSim, bluewhale-canvas-core, rstdoc, galaxy-lib, > orange-canvas-core-ml, meditor, jarn.viewdoc, formiko) > * 4 are agnostic to output type, as they pass the output of > ``publish_string`` straight into ``BeautifulSoup()`` or > ``xml.etree.ElementTree.fromstring``, both of which accept either bytes > or str. (doc-warden, testimony, pyLanguagetool, turq) Good news for Docutils: we are not alone. "xml.etree" also uses: "string" or "string constant" as a superordinate term for a sequence of characters, either encoded (`bytes`) or as Unicode code points (`str`). "unicode" as a pseudo-encoding name for "no encoding" (i.e. "return as `str` instance"). Maybe we can agree with the etree team on a compatible terminology and way forward. > * 3 use custom writers or the document tree, and don't use the returned > output (pydoctor, restview, fairy-slipper) > * 2 are broken by calling ``str()`` on a bytes instance without an > ``encoding`` argument. (prettyqt, cornice_sphinx) > * 1 ignores output and just uses the call to check it doesn't raise any > exceptions (rstcheck-core) > * 3 expect ``bytes`` and could use the proposed ``publish_bytes()`` > function (awscli, bugrest, quorachallenge) One more, `pyreport`_, is currently unmaintained and Python2 only... .. _pyreport: https://github.com/joblib/pyreport There may be more use cases in unpublished packages/modules/scripts or helper scripts in non-Python projects. > I am happy to work with the ~17 (14 + 3) that would be affected to help > them to refactor, should we agree on a way forwards. I am quite confident that we will find a consensus. I would still want to revert the FutureWarnings until there is a stable alternative in place. > Out of interest, none used an ``output_encoding`` setting other than > "unicode" or "utf-8". Did you also check the configuration files? Docutils also defaults to "output_encoding: utf-8" but allows users to change this to any valid encoding via settings_spec or settings_overrides or in a configuration file. (Just checked: publish_string() respects the "output_encoding" set in a docutils.conf file.) > I would be content to delay the switch-over of return type from > ``publish_string`` to Docutils 1.0 or 2.0 should more time be needed, > but I suppose I see the other scenarios as sub-optimal for the > long-term in one way or another -- e.g. ``publish_str_instance`` is > unweidly to use regularly, and using e.g. ``publish_str`` instead would > be confusing when ``publish_string`` still exists. OTOH, `publish_string()` vs. `publish_bytes()` mismatch: one uses a Python3 datatype name while the other an overloaded general term. >>>> Regarding the "core.publish_string()" function, I see three possibilities: >>>> Alternatives forward: >>>> 1. [Revert to Docutils 0.19 behaviour, with clearer documentation]. >>>> 2. Add a new boolean argument: "encode". >>>> 3. Deprecate "publish_string()" in favour of new, separate "publish_str()" and "publish_bytes()" functions. During the transition period, editors with name completion will show both `publish_str()` and `publish_string()` in the expansion list and coders will likely look up the docstring for the difference. >> If the documentation is clear about possible return values (and even >> more after adding type hints) users should be able to live with the >> unfortunate naming. > Unfortunatley as far as I am aware type hints are unable to code for a > setting within a dictionary affecting the return type of the function. > I agree the documentation should be made clearer. Type hints should support documenting the fact that a function accepts or returns any of a set of data types (e.g. "`int` or `str`", "`int` or `float`", or "`str` or `bytes`"). The details/conditions should be given in the docstring. >> OTOH, I see a use-case for a convenience function returning a `str` >> instance also in cases where an "intended encoding" of the output is >> given in the "output-encoding" setting. This way, a program using this >> function can export a HTML, XML or LaTeX with an encoding declaration >> as `str` instance, post-process and finally encode it before handing >> it to storage or a non-Python processor. > Yes, this is my general view too -- I see ``publish_string`` as a > function to be called from other Python programmes. >> If we are going to change the core API functionality regarding the >> convenience function(s) to publish the output as `str` or `bytes` >> instance, then we should: >> * do not start this in the middle of a major refactoring of the test suite >> (where it is hard to spot the changes in expected output from >> "cosmetic" changes in the test code). > I agree with this, in retrospect it was a poor choice. >> * do it in a "quasi static" manner: both, old and the new behaviour must >> be accessible over a sequence of two or more stable releases. > This of course makes sense. >> This means that if we want to introduce an explicit `publish_bytes()` >> convenience function, a corresponding `BytesOutput` class is >> appropriate. > OK, though it seems this is dependent on the outcome of the > ``publish_string`` decision. Maybe we can also directly support `str` as `destination_class` value in core.Publisher and publish_programmatically(). The whole problem looks like a candidate for one more enhancement proposal ;) Günter |
From: Adam T. <aat...@ou...> - 2022-11-16 21:11:11
|
Dear Günter, > the commit r9245 eliminates the deliberate distinction between Python > object names (up to r9244 marked up with the default "title-reference" > role, not *emphasis*!) and filenames or code examples (marked up as > "inline literal"). Thank you for the clarification. I suggest documenting this in a comment at the start of the HISTORY file, as the distinction was entirely lost on me. We might also consider using explicit markup for clarity (either ``:title:``, or a custom code role ``:py:``). For programme names, such as "pandoc", "flake8", and "2to3", what syntax would we use? Following the rule outlined in your note, these would use literal syntax, I believe, though I would like to check before reverting a reversion. There are some Python names that were previously using literal syntax that should likely be modified, e.g. "HTMLTranslator.topic_classes", "use_latex_toc", "split_escaped_whitespace", etc. Finally, for expressions in the HISTORY file (e.g. "parts['title']", "footnote_backlinks==False", etc), what syntax should we use? Thanks, Adam |
From: Adam T. <aat...@ou...> - 2022-11-16 20:39:40
|
Since Python 3.3 (PEP 393), all Python builds have support for the full range of Unicode, and hence there are no longer "wide" and "narrow" builds. As such, I propose the patch below to remove "wide" from ``generate_punctuation_chars.py``. Note this is API preserving as the resulting "delimiters" string remains the same (the difference is that it is now a constant rather than the concatenation of two strings). ----- Index: docutils/tools/dev/generate_punctuation_chars.py =================================================================== --- docutils/tools/dev/generate_punctuation_chars.py (revision 9254) +++ docutils/tools/dev/generate_punctuation_chars.py (working copy) @@ -55,8 +55,6 @@ # ``docutils/tools/dev/generate_punctuation_chars.py``. # :: -import sys - """Docutils character category patterns. Patterns for the implementation of the `inline markup recognition rules`_ @@ -86,8 +84,6 @@ %(openers)s %(closers)s %(delimiters)s -if sys.maxunicode >= 0x10FFFF: # "wide" build -%(delimiters_wide)s closing_delimiters = r'\\.,;!?' @@ -245,14 +241,6 @@ closing_delimiters)] -def separate_wide_chars(s): - """Return (s1,s2) with characters above 0xFFFF in s2""" - maxunicode_narrow = 0xFFFF - l1 = [ch for ch in s if ord(ch) <= maxunicode_narrow] - l2 = [ch for ch in s if ord(ch) > maxunicode_narrow] - return ''.join(l1), ''.join(l2) - - def mark_intervals(s): """Return s with shortcut notation for runs of consecutive characters @@ -281,6 +269,7 @@ def wrap_string(s, startstring="(", endstring=" )", wrap=71): """Line-wrap a unicode string literal definition.""" + s = s.encode('unicode-escape').decode() c = len(startstring) left_indent = ' '*(c - len(startstring.lstrip(' '))) line_start_string = f"\n {left_indent}'" @@ -332,18 +321,11 @@ (o, c, d, cd) = character_category_patterns() -# Characters in the upper plane require a "wide" build:: - - o, o_wide = separate_wide_chars(o) - c, c_wide = separate_wide_chars(c) - d, d_wide = separate_wide_chars(d) - # delimiters: sort and use shortcut for intervals (saves ~150 characters) # (`openers` and `closers` must be verbose and keep order # because they are also used in `match_chars()`):: d = d[:5] + mark_intervals(d[5:]) - d_wide = mark_intervals(d_wide) # Test: compare module content with re-generated definitions @@ -364,13 +346,8 @@ % unicodedata.unidata_version) print_differences(openers, o, 'openers') - if o_wide: - print('+ openers-wide = r"""%s"""' % o_wide.encode('utf-8')) print_differences(closers, c, 'closers') - if c_wide: - print('+ closers-wide = r"""%s"""' % c_wide.encode('utf-8')) - - print_differences(delimiters, d + d_wide, 'delimiters') + print_differences(delimiters, d, 'delimiters') print_differences(closing_delimiters, cd, 'closing_delimiters') sys.exit() @@ -386,15 +363,9 @@ substitutions = { 'python_version': sys.version.split()[0], 'unidata_version': unicodedata.unidata_version, - 'openers': wrap_string(o.encode('unicode-escape').decode(), - startstring="openers = ("), - 'closers': wrap_string(c.encode('unicode-escape').decode(), - startstring="closers = ("), - 'delimiters': wrap_string(d.encode('unicode-escape').decode(), - startstring="delimiters = ("), - 'delimiters_wide': wrap_string( - d_wide.encode('unicode-escape').decode(), - startstring=" delimiters += (") + 'openers': wrap_string(o, startstring="openers = ("), + 'closers': wrap_string(c, startstring="closers = ("), + 'delimiters': wrap_string(d, startstring="delimiters = ("), } print(module_template % substitutions, end='') ----- Thanks, Adam |
From: Guenter M. <mi...@us...> - 2022-11-16 13:59:30
|
Dear Adam, the commit r9245 eliminates the deliberate distinction between Python object names (up to r9244 marked up with the default "title-reference" role, not *emphasis*!) and filenames or code examples (marked up as "inline literal"). Please revert. If the italic rendering is a problem, this can be solved changing the default role or the styling of "title-reference" for the affected files. Günter |
From: Guenter M. <mi...@us...> - 2022-11-16 13:37:15
|
Dear Adam, thank you for the clarifications. On 2022-11-15, Adam Turner wrote: ... >> "python-docutils" RPM packages are part of, e.g., the SuSe and Fedora Linux >> distributions. ... > Fedora uses the modern and standards compliant "pyproject" (PEP 517 & > 518) approach: ... > Opensuse also use the modern approach: ... > In general, the move is that Python packaging tools should not publish > binary distributions for anything other than Python packaging standards > (the Wheel specification), and repackagers for other distributions or > platforms (e.g. ".deb" for debian, or ".rpm" for the red hat ecosystem) > should use their own tooling. >> If there are reasons to stop this support for RPM packagers, this >> should be clearly communicated (starting with an "end of service >> announcement" in the "Future Changes" section of the RELEASE-NOTES). > I shall add a notice, but note as above this does not stop support for > RPM packagers, as they do not use "setup.py bdist_rpm". We don't know if anyone else has ``setup.py bdist_rpm`` in their workflow. However, since dropping support for "setup.py bdist_rpm" only affects package maintainers (and/or home-packagers) and the known "main customers" are not affected, I tend to agree to do the removal without an advance warning. A notice is, IMO required before the next release. Thanks, Günter |
From: Adam T. <aat...@ou...> - 2022-11-15 16:12:00
|
Dear Günter, [snip] > The reason for the [bdist_rpm] section is not publishing on PyPI but > facilitating the inclusion of Docutils in 3rd party software > distributions using the RPM package format. > "python-docutils" RPM packages are part of, e.g., the SuSe and Fedora Linux > distributions. > https://koji.fedoraproject.org/koji/buildinfo?buildID=2022758 > https://gitea.opensuse.org/rpm/python-docutils Fedora uses the modern and standards compliant "pyproject" (PEP 517 & 518) approach: https://src.fedoraproject.org/rpms/python-docutils/blob/rawhide/f/python-docutils.spec#_49 Opensuse also use the modern approach: https://gitea.opensuse.org/rpm/python-docutils/src/branch/factory/python-docutils.spec#L75 In general, the move is that Python packaging tools should not publish binary distributions for anything other than Python packaging standards (the Wheel specification), and repackagers for other distributions or platforms (e.g. ".deb" for debian, or ".rpm" for the red hat ecosystem) should use their own tooling. > If there are reasons to stop this support for RPM packagers, this should be > clearly communicated (starting with an "end of service announcement" > in the "Future Changes" section of the RELEASE-NOTES). I shall add a notice, but note as above this does not stop support for RPM packagers, as they do not use "setup.py bdist_rpm". Thanks, Adam |
From: Guenter M. <mi...@us...> - 2022-11-15 09:34:05
|
Dear Adam, dear docutils developers, the commit r9177 does "Remove ``bdist_rpm`` settings in ``setup.cfg``". The reasons stated in the commit message are not convincing: > Docutils does not publish RPMs, While the Docutils project does not build RPM packages itself and does not plan to do so, the the [bdist_rpm] section was introduced in response to a public request in https://sourceforge.net/p/docutils/bugs/122/. > the command is no longer supported for the Python Package Index. See > :pep:`527` for further details." The reason for the [bdist_rpm] section is not publishing on PyPI but facilitating the inclusion of Docutils in 3rd party software distributions using the RPM package format. "python-docutils" RPM packages are part of, e.g., the SuSe and Fedora Linux distributions. https://koji.fedoraproject.org/koji/buildinfo?buildID=2022758 https://gitea.opensuse.org/rpm/python-docutils If there are reasons to stop this support for RPM packagers, this should be clearly communicated (starting with an "end of service announcement" in the "Future Changes" section of the RELEASE-NOTES). Günter |
From: engelbert g. <gr...@us...> - 2022-11-14 09:26:56
|
- **status**: open --> closed-fixed - **Comment**: reading this from [pya](https://github.com/pypa/setuptools/issues/3340#issuecomment-1146678086) > > Yes, I recommend adding all the sub-directories to the list of packages, even if they only include data files. On the bright side that can be done with find_namespace_packages (setup.py) or find_namespace: (setup.cfg). I will add the directories --- ** [patches:#199] Missing packages in setup.py** **Status:** closed-fixed **Group:** None **Created:** Tue Nov 08, 2022 08:44 AM UTC by Veslin Jean-Baptiste **Last Updated:** Mon Nov 14, 2022 09:21 AM UTC **Owner:** nobody Hello When building docutils from sources on python 3.10 with setuptools 63.2.0, I have the following warnings : ~~~ SetuptoolsDeprecationWarning: Installing 'docutils.parsers.rst.include' as data is deprecated, please list it in `packages` SetuptoolsDeprecationWarning: Installing 'docutils.writers.s5_html.themes' as data is deprecated, please list it in `packages`. SetuptoolsDeprecationWarning: Installing 'docutils.writers.s5_html.themes.default' as data is deprecated, please list it in `packages`. ~~~ I think these 3 packages should be listed in `packages` in `setup.py` Regards --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/patches/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/patches/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: engelbert g. <gr...@us...> - 2022-11-14 09:21:39
|
reading this from [pya](https://github.com/pypa/setuptools/issues/3340#issuecomment-1146678086) > > Yes, I recommend adding all the sub-directories to the list of packages, even if they only include data files. On the bright side that can be done with find_namespace_packages (setup.py) or find_namespace: (setup.cfg). I will add the directories --- ** [patches:#199] Missing packages in setup.py** **Status:** open **Group:** None **Created:** Tue Nov 08, 2022 08:44 AM UTC by Veslin Jean-Baptiste **Last Updated:** Mon Nov 14, 2022 09:13 AM UTC **Owner:** nobody Hello When building docutils from sources on python 3.10 with setuptools 63.2.0, I have the following warnings : ~~~ SetuptoolsDeprecationWarning: Installing 'docutils.parsers.rst.include' as data is deprecated, please list it in `packages` SetuptoolsDeprecationWarning: Installing 'docutils.writers.s5_html.themes' as data is deprecated, please list it in `packages`. SetuptoolsDeprecationWarning: Installing 'docutils.writers.s5_html.themes.default' as data is deprecated, please list it in `packages`. ~~~ I think these 3 packages should be listed in `packages` in `setup.py` Regards --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/patches/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/patches/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: engelbert g. <gr...@us...> - 2022-11-14 09:13:20
|
If packages are packages of code for docutils processing text and these are files to include into rst-files they might be no package but then they are in a library subdriectory ? --- ** [patches:#199] Missing packages in setup.py** **Status:** open **Group:** None **Created:** Tue Nov 08, 2022 08:44 AM UTC by Veslin Jean-Baptiste **Last Updated:** Tue Nov 08, 2022 08:44 AM UTC **Owner:** nobody Hello When building docutils from sources on python 3.10 with setuptools 63.2.0, I have the following warnings : ~~~ SetuptoolsDeprecationWarning: Installing 'docutils.parsers.rst.include' as data is deprecated, please list it in `packages` SetuptoolsDeprecationWarning: Installing 'docutils.writers.s5_html.themes' as data is deprecated, please list it in `packages`. SetuptoolsDeprecationWarning: Installing 'docutils.writers.s5_html.themes.default' as data is deprecated, please list it in `packages`. ~~~ I think these 3 packages should be listed in `packages` in `setup.py` Regards --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/patches/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/patches/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: Adam T. <aat...@ou...> - 2022-11-13 19:49:52
|
Dear Günter, >> ----- >>>>> The naming of the `core.publish_string()` API function > I see your point. OTOH: > * `output-encoding`__ is a *general* setting defined as > "The text encoding for output". > This raises the expectation that all Docutils output "has" the > specified encoding and makes the "most obvious" return value a bit less > obvious. > > __ https://docutils.sourceforge.io/docs/user/config.html#output-encoding > * The behaviour of `publish_string()` has been stable for many years. > Long-time users are familiar with it and expect it to remain stable. There are 1283 projects published on PyPI that depend on Docutils. I have gone through each of these projects, there are 35 (2.7%) that use the ``docutils.core.publish_string`` function. Of those: * 8 set ``'output_encoding': 'unicode'``, so would be unaffected by the eventual change to return strings. (traitsui, odoo-tools, CodeChat, benchmarkstt, pyfda, pyretis, anna, resplendent) * 14 use the "UTF-8" encoding and call ``.decode()`` straight after, so would have to refactor but want to use Python strings. (Orange-Canvas-Core, galaxy-util, vb2py, gluetool, madgui, pydoc-fork, ScopeSim, bluewhale-canvas-core, rstdoc, galaxy-lib, orange-canvas-core-ml, meditor, jarn.viewdoc, formiko) * 4 are agnostic to output type, as they pass the output of ``publish_string`` straight into ``BeautifulSoup()`` or ``xml.etree.ElementTree.fromstring``, both of which accept either bytes or str. (doc-warden, testimony, pyLanguagetool, turq) * 3 use custom writers or the document tree, and don't use the returned output (pydoctor, restview, fairy-slipper) * 2 are broken by calling ``str()`` on a bytes instance without an ``encoding`` argument. (prettyqt, cornice_sphinx) * 1 ignores output and just uses the call to check it doesn't raise any exceptions (rstcheck-core) * 3 expect ``bytes`` and could use the proposed ``publish_bytes()`` function (awscli, bugrest, quorachallenge) I am happy to work with the ~17 (14 + 3) that would be affected to help them to refactor, should we agree on a way forwards. Out of interest, none used an ``output_encoding`` setting other than "unicode" or "utf-8". I would be content to delay the switch-over of return type from ``publish_string`` to Docutils 1.0 or 2.0 should more time be needed, but I suppose I see the other scenarios as sub-optimal for the long-term in one way or another -- e.g. ``publish_str_instance`` is unweidly to use regularly, and using e.g. ``publish_str`` instead would be confusing when ``publish_string`` still exists. >>> Regarding the "core.publish_string()" function, I see three possibilities: >>> Alternatives forward: >>> 1. [Revert to Docutils 0.19 behaviour, with clearer documentation]. >>> 2. Add a new boolean argument: "encode". >>> 3. Deprecate "publish_string()" in favour of new, separate >>> "publish_unicode_str()" and "publish_bytes()" functions. >>> 4. [Revert] "publish_string()" [to Docutils 0.19 behaviour]. >>> New function "publish_str_instance()", say. > If the documentation is clear about possible return values (and even more after adding type hints) users should be able to live with the unfortunate naming. Unfortunatley as far as I am aware type hints are unable to code for a setting within a dictionary affecting the return type of the function. I agree the documentation should be made clearer. > OTOH, I see a use-case for a convenience function returning a `str` instance also in cases where an "intended encoding" of the output is given in the "output-encoding" setting. This way, a program using this function can export a HTML, XML or LaTeX with an encoding declaration as `str` instance, post-process and finally encode it before handing it to storage or a non-Python processor. Yes, this is my general view too -- I see ``publish_string`` as a function to be called from other Python programmes. > If we are going to change the core API functionality regarding the convenience function(s) to publish the output as `str` or `bytes` instance, then we should: > * do not start this in the middle of a major refactoring of the test suite > (where it is hard to spot the changes in expected output from > "cosmetic" changes in the test code). I agree with this, in retrospect it was a poor choice. > * do it in a "quasi static" manner: both, old and the new behaviour must > be accessible over a sequence of two or more stable releases. This of course makes sense. > This means that if we want to introduce an explicit `publish_bytes()` convenience function, a corresponding `BytesOutput` class is appropriate. OK, though it seems this is dependent on the outcome of the ``publish_string`` decision. ----- Thanks, Adam |
From: Adam T. <aa-...@us...> - 2022-11-10 17:12:29
|
- **summary**: 0.17.1: pytest is failing --> Support for pytest --- ** [feature-requests:#81] Support for pytest** **Status:** closed-fixed **Group:** Default **Created:** Sun Jun 27, 2021 03:07 AM UTC by Tomasz Kłoczko **Last Updated:** Thu Nov 10, 2022 05:11 PM UTC **Owner:** nobody Just normal build, install and test cycle used on building package from non-root account: - "setup.py build" - "setup.py install --root </install/prefix>" - "pytest with PYTHONPATH pointing to setearch and sitelib inside </install/prefix> ~~~ + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + PYTHONDONTWRITEBYTECODE=1 + /usr/bin/pytest -ra =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000) Using --randomly-seed=2664516846 rootdir: /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1 plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, httpbin-1.0.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, cases-3.6.1, flaky-3.7.0, hypothesis-6.14.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, randomly-3.8.0, Faker-8.8.2, datadir-1.3.1, regressions-2.2.0 collected 240 items test/test_statemachine.py ................. [ 7%] test/test_functional.py E [ 7%] test/test_dependencies.py ..... [ 9%] test/test_parsers/test_get_parser_class.py ... [ 10%] test/test_writers/test_latex2e_misc.py . [ 11%] test/test_publisher.py .... [ 12%] test/test_writers/test_get_writer_class.py ... [ 14%] test/test__init__.py .. [ 15%] . . [ 15%] test/test__init__.py ...... [ 17%] test/test_settings.py ........................ [ 28%] test/test_writers/test_docutils_xml.py ..... [ 30%] test/test_parsers/test_parser.py . [ 30%] test/test_transforms/test___init__.py . [ 30%] test/test_language.py EEEE [ 32%] test/test_traversals.py . [ 33%] test/test_writers/test_odt.py .......... [ 37%] test/test_command_line.py F [ 37%] test/test_writers/test_html5_polyglot_parts.py EE [ 38%] test/test_nodes.py ............................... [ 51%] test/test_writers/test_html5_polyglot_misc.py ............... [ 57%] test/test_pickle.py . [ 58%] tools/test/test_buildhtml.py .. [ 58%] test/test_io.py ................. [ 66%] test/test_readers/test_get_reader_class.py ... [ 67%] test/test_error_reporting.py ............. [ 72%] test/test_writers/test_html4css1_misc.py ............... [ 79%] test/test_parsers/test_rst/test_directives/test_code_parsing.py .. [ 79%] test/test_utils.py ........................ [ 89%] test/test_parsers/test_recommonmark/test_misc.py ..Fs [ 91%] test/test_parsers/test_rst/test_directives/test__init__.py .... [ 93%] test/test_viewlist.py ................ [100%] ================================================================================== ERRORS ================================================================================== ________________________________________________________________ ERROR at setup of FunctionalTestCase.test _________________________________________________________________ self = <[AttributeError("'FunctionalTestCase' object has no attribute '_testMethodName'") raised in repr()] FunctionalTestCase object at 0x7fbd75666df0>, args = ('test',) kwargs = {} def __init__(self, *args, **kwargs): """Set self.configfile, pass arguments to parent __init__.""" > self.configfile = kwargs['configfile'] E KeyError: 'configfile' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_functional.py:95: KeyError ____________________________________________________________ ERROR at setup of LanguageTestCase.test_directives ____________________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd754ce0d0> args = ('test_directives',), kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError ______________________________________________________________ ERROR at setup of LanguageTestCase.test_roles _______________________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd753f98b0>, args = ('test_roles',) kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError _______________________________________________________ ERROR at setup of LanguageTestCase.test_bibliographic_fields _______________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd753c4850> args = ('test_bibliographic_fields',), kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError ______________________________________________________________ ERROR at setup of LanguageTestCase.test_labels ______________________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd754181f0> args = ('test_labels',), kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError ______________________________________________________ ERROR at setup of HtmlWriterPublishPartsTestCase.test_publish _______________________________________________________ self = <[AttributeError("'HtmlWriterPublishPartsTestCase' object has no attribute '_testMethodName'") raised in repr()] HtmlWriterPublishPartsTestCase object at 0x7fbd54e7e550> args = ('test_publish',), kwargs = {} def __init__(self, *args, **kwargs): if 'writer_name' in kwargs: self.writer_name = kwargs['writer_name'] del kwargs['writer_name'] > CustomTestCase.__init__(self, *args, **kwargs) E TypeError: __init__() missing 3 required positional arguments: 'input', 'expected', and 'id' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/DocutilsTestSupport.py:673: TypeError ______________________________________________________ ERROR at setup of Html5WriterPublishPartsTestCase.test_publish ______________________________________________________ self = <[AttributeError("'Html5WriterPublishPartsTestCase' object has no attribute '_testMethodName'") raised in repr()] Html5WriterPublishPartsTestCase object at 0x7fbd75348160> args = ('test_publish',), kwargs = {} def __init__(self, *args, **kwargs): if 'writer_name' in kwargs: self.writer_name = kwargs['writer_name'] del kwargs['writer_name'] > CustomTestCase.__init__(self, *args, **kwargs) E TypeError: __init__() missing 3 required positional arguments: 'input', 'expected', and 'id' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/DocutilsTestSupport.py:673: TypeError ================================================================================= FAILURES ================================================================================= _____________________________________________________________ CommandLineEncodingTests.test_sys_argv_decoding ______________________________________________________________ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, args = ['-ra', '--source-url=test.txt', '--title=Dornröschen'] values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> def parse_args(self, args=None, values=None): """ parse_args(args : [string] = sys.argv[1:], values : Values = None) -> (values : Values, args : [string]) Parse the command-line options found in 'args' (default: sys.argv[1:]). Any errors result in a call to 'error()', which by default prints the usage message to stderr and calls sys.exit() with an error message. On success returns a pair (values, args) where 'values' is a Values instance (with all your option values) and 'args' is the list of arguments left over after parsing options. """ rargs = self._get_args(args) if values is None: values = self.get_default_values() # Store the halves of the argument list as attributes for the # convenience of callbacks: # rargs # the rest of the command-line (the "r" stands for # "remaining" or "right-hand") # largs # the leftover arguments -- ie. what's left after removing # options and their arguments (the "l" stands for "leftover" # or "left-hand") self.rargs = rargs self.largs = largs = [] self.values = values try: > stop = self._process_args(largs, rargs, values) /usr/lib64/python3.8/optparse.py:1387: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, largs = [], rargs = ['--source-url=test.txt', '--title=Dornröschen'] values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> def _process_args(self, largs, rargs, values): """_process_args(largs : [string], rargs : [string], values : Values) Process command-line arguments and populate 'values', consuming options and arguments from 'rargs'. If 'allow_interspersed_args' is false, stop at the first non-option argument. If true, accumulate any interspersed non-option arguments in 'largs'. """ while rargs: arg = rargs[0] # We handle bare "--" explicitly, and bare "-" is handled by the # standard arg handler since the short arg case ensures that the # len of the opt string is greater than 1. if arg == "--": del rargs[0] return elif arg[0:2] == "--": # process a single long option (possibly with value(s)) self._process_long_opt(rargs, values) elif arg[:1] == "-" and len(arg) > 1: # process a cluster of short options (possibly with # value(s) for the last one only) > self._process_short_opts(rargs, values) /usr/lib64/python3.8/optparse.py:1431: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, rargs = ['--source-url=test.txt', '--title=Dornröschen'] values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> def _process_short_opts(self, rargs, values): arg = rargs.pop(0) stop = False i = 1 for ch in arg[1:]: opt = "-" + ch option = self._short_opt.get(opt) i += 1 # we have consumed a character if not option: raise BadOptionError(opt) if option.takes_value(): # Any characters left in arg? Pretend they're the # next arg, and stop consuming characters of arg. if i < len(arg): rargs.insert(0, arg[i:]) stop = True nargs = option.nargs if len(rargs) < nargs: self.error(ngettext( "%(option)s option requires %(number)d argument", "%(option)s option requires %(number)d arguments", nargs) % {"option": opt, "number": nargs}) elif nargs == 1: value = rargs.pop(0) else: value = tuple(rargs[0:nargs]) del rargs[0:nargs] else: # option doesn't take a value value = None > option.process(opt, value, values, self) /usr/lib64/python3.8/optparse.py:1536: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> parser = <docutils.frontend.OptionParser object at 0x7fbd54bba550> def process(self, opt, value, values, parser): """ Call the validator function on applicable settings and evaluate the 'overrides' option. Extends `optparse.Option.process`. """ > result = optparse.Option.process(self, opt, value, values, parser) /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/frontend.py:354: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> parser = <docutils.frontend.OptionParser object at 0x7fbd54bba550> def process(self, opt, value, values, parser): # First, convert the value(s) to the right type. Howl if any # value(s) are bogus. > value = self.convert_value(opt, value) /usr/lib64/python3.8/optparse.py:779: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' def convert_value(self, opt, value): if value is not None: if self.nargs == 1: > return self.check_value(opt, value) /usr/lib64/python3.8/optparse.py:771: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' def check_value(self, opt, value): checker = self.TYPE_CHECKER.get(self.type) if checker is None: return value else: > return checker(self, opt, value) /usr/lib64/python3.8/optparse.py:766: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ option = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' def check_choice(option, opt, value): if value in option.choices: return value else: choices = ", ".join(map(repr, option.choices)) > raise OptionValueError( _("option %s: invalid choice: %r (choose from %s)") % (opt, value, choices)) E optparse.OptionValueError: option -r: invalid choice: 'a' (choose from 'info', '1', 'warning', '2', 'error', '3', 'severe', '4', 'none', '5') /usr/lib64/python3.8/optparse.py:440: OptionValueError During handling of the above exception, another exception occurred: self = <test_command_line.CommandLineEncodingTests testMethod=test_sys_argv_decoding> def test_sys_argv_decoding(self): if argv_encoding == 'ascii': # cannot test return sys.argv.append('--source-url=test.txt') # pure ASCII argument if sys.version_info < (3, 0): sys.argv.append(u'--title=Dornröschen'.encode(argv_encoding)) else: sys.argv.append(u'--title=Dornröschen') publisher = docutils.core.Publisher() > publisher.process_command_line() /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_command_line.py:41: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:162: in process_command_line self.settings = option_parser.parse_args(argv) /usr/lib64/python3.8/optparse.py:1389: in parse_args self.error(str(err)) /usr/lib64/python3.8/optparse.py:1569: in error self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, status = 2 msg = "pytest: error: option -r: invalid choice: 'a' (choose from 'info', '1', 'warning', '2', 'error', '3', 'severe', '4', 'none', '5')\n" def exit(self, status=0, msg=None): if msg: sys.stderr.write(msg) > sys.exit(status) E SystemExit: 2 /usr/lib64/python3.8/optparse.py:1559: SystemExit --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- Usage ===== pytest [options] pytest: error: option -r: invalid choice: 'a' (choose from 'info', '1', 'warning', '2', 'error', '3', 'severe', '4', 'none', '5') ________________________________________________________________ reCommonMarkParserTests.test_parsing_error ________________________________________________________________ self = <test_parsers.test_recommonmark.test_misc.reCommonMarkParserTests testMethod=test_parsing_error> @unittest.skipUnless(recommonmark_wrapper.CommonMarkParser, skip_msg) def test_parsing_error(self): > output = publish_string(sample1, parser_name='recommonmark', settings_overrides={'warning_stream': ''}) /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_misc.py:55: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:407: in publish_string output, pub = publish_programmatically( /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:665: in publish_programmatically output = pub.publish(enable_exit_status=enable_exit_status) /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:217: in publish self.document = self.reader.read(self.source, self.parser, /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/readers/__init__.py:72: in read self.parse() /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/readers/__init__.py:78: in parse self.parser.parse(self.input, document) /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/parsers/recommonmark_wrapper.py:117: in parse if node['level'] != section_level: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <section "title": <title...><paragraph...>>, key = 'level' def __getitem__(self, key): if isinstance(key, basestring): > return self.attributes[key] E KeyError: 'level' /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/nodes.py:652: KeyError ============================================================================= warnings summary ============================================================================= test/test_parsers/test_recommonmark/test_section_headers.py:37 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_section_headers.py:37: DeprecationWarning: invalid escape sequence \ """\ test/test_parsers/test_recommonmark/test_section_headers.py:50 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_section_headers.py:50: DeprecationWarning: invalid escape sequence \ """\ test/test_parsers/test_recommonmark/test_section_headers.py:164 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_section_headers.py:164: DeprecationWarning: invalid escape sequence \ """\ test/test_transforms/test___init__.py:20 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_transforms/test___init__.py:20: PytestCollectionWarning: cannot collect test class 'TestTransform' because it has a __init__ constructor (from: test/test_transforms/test___init__.py) class TestTransform(transforms.Transform): test/test_settings.py::ConfigFileTests::test_old test/test_settings.py::ConfigFileTests::test_old_and_new test/test_settings.py::ConfigEnvVarFileTests::test_old_and_new test/test_settings.py::ConfigEnvVarFileTests::test_old /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/data/config_old.txt:0: ConfigDeprecationWarning: The "[option]" section is deprecated. Support for old-format configuration files may be removed in a future Docutils release. Please revise your configuration files. See <http://docutils.sf.net/docs/user/config.html>, section "Old-Format Configuration Files". test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_raw_disabled_inline test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_raw_disabled test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_parsing_error /usr/lib/python3.8/site-packages/recommonmark/parser.py:75: UserWarning: Container node skipped: type=document warn("Container node skipped: type={0}".format(mdnode.t)) -- Docs: https://docs.pytest.org/en/stable/warnings.html ========================================================================= short test summary info ========================================================================== SKIPPED [1] test/test_parsers/test_recommonmark/test_misc.py:91: recommonmark_wrapper: parser found, fallback not used ERROR test/test_functional.py::FunctionalTestCase::test - KeyError: 'configfile' ERROR test/test_language.py::LanguageTestCase::test_directives - KeyError: 'language' ERROR test/test_language.py::LanguageTestCase::test_roles - KeyError: 'language' ERROR test/test_language.py::LanguageTestCase::test_bibliographic_fields - KeyError: 'language' ERROR test/test_language.py::LanguageTestCase::test_labels - KeyError: 'language' ERROR test/test_writers/test_html5_polyglot_parts.py::HtmlWriterPublishPartsTestCase::test_publish - TypeError: __init__() missing 3 required positional arguments: 'inpu... ERROR test/test_writers/test_html5_polyglot_parts.py::Html5WriterPublishPartsTestCase::test_publish - TypeError: __init__() missing 3 required positional arguments: 'inp... FAILED test/test_command_line.py::CommandLineEncodingTests::test_sys_argv_decoding - SystemExit: 2 FAILED test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_parsing_error - KeyError: 'level' ===================================================== 2 failed, 229 passed, 1 skipped, 11 warnings, 7 errors in 10.64s ===================================================== ~~~ --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/feature-requests/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/feature-requests/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: Adam T. <aa-...@us...> - 2022-11-10 17:11:58
|
- **status**: open --> closed-fixed --- ** [feature-requests:#81] 0.17.1: pytest is failing** **Status:** closed-fixed **Group:** Default **Created:** Sun Jun 27, 2021 03:07 AM UTC by Tomasz Kłoczko **Last Updated:** Thu Nov 10, 2022 05:11 PM UTC **Owner:** nobody Just normal build, install and test cycle used on building package from non-root account: - "setup.py build" - "setup.py install --root </install/prefix>" - "pytest with PYTHONPATH pointing to setearch and sitelib inside </install/prefix> ~~~ + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + PYTHONDONTWRITEBYTECODE=1 + /usr/bin/pytest -ra =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000) Using --randomly-seed=2664516846 rootdir: /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1 plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, httpbin-1.0.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, cases-3.6.1, flaky-3.7.0, hypothesis-6.14.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, randomly-3.8.0, Faker-8.8.2, datadir-1.3.1, regressions-2.2.0 collected 240 items test/test_statemachine.py ................. [ 7%] test/test_functional.py E [ 7%] test/test_dependencies.py ..... [ 9%] test/test_parsers/test_get_parser_class.py ... [ 10%] test/test_writers/test_latex2e_misc.py . [ 11%] test/test_publisher.py .... [ 12%] test/test_writers/test_get_writer_class.py ... [ 14%] test/test__init__.py .. [ 15%] . . [ 15%] test/test__init__.py ...... [ 17%] test/test_settings.py ........................ [ 28%] test/test_writers/test_docutils_xml.py ..... [ 30%] test/test_parsers/test_parser.py . [ 30%] test/test_transforms/test___init__.py . [ 30%] test/test_language.py EEEE [ 32%] test/test_traversals.py . [ 33%] test/test_writers/test_odt.py .......... [ 37%] test/test_command_line.py F [ 37%] test/test_writers/test_html5_polyglot_parts.py EE [ 38%] test/test_nodes.py ............................... [ 51%] test/test_writers/test_html5_polyglot_misc.py ............... [ 57%] test/test_pickle.py . [ 58%] tools/test/test_buildhtml.py .. [ 58%] test/test_io.py ................. [ 66%] test/test_readers/test_get_reader_class.py ... [ 67%] test/test_error_reporting.py ............. [ 72%] test/test_writers/test_html4css1_misc.py ............... [ 79%] test/test_parsers/test_rst/test_directives/test_code_parsing.py .. [ 79%] test/test_utils.py ........................ [ 89%] test/test_parsers/test_recommonmark/test_misc.py ..Fs [ 91%] test/test_parsers/test_rst/test_directives/test__init__.py .... [ 93%] test/test_viewlist.py ................ [100%] ================================================================================== ERRORS ================================================================================== ________________________________________________________________ ERROR at setup of FunctionalTestCase.test _________________________________________________________________ self = <[AttributeError("'FunctionalTestCase' object has no attribute '_testMethodName'") raised in repr()] FunctionalTestCase object at 0x7fbd75666df0>, args = ('test',) kwargs = {} def __init__(self, *args, **kwargs): """Set self.configfile, pass arguments to parent __init__.""" > self.configfile = kwargs['configfile'] E KeyError: 'configfile' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_functional.py:95: KeyError ____________________________________________________________ ERROR at setup of LanguageTestCase.test_directives ____________________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd754ce0d0> args = ('test_directives',), kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError ______________________________________________________________ ERROR at setup of LanguageTestCase.test_roles _______________________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd753f98b0>, args = ('test_roles',) kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError _______________________________________________________ ERROR at setup of LanguageTestCase.test_bibliographic_fields _______________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd753c4850> args = ('test_bibliographic_fields',), kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError ______________________________________________________________ ERROR at setup of LanguageTestCase.test_labels ______________________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd754181f0> args = ('test_labels',), kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError ______________________________________________________ ERROR at setup of HtmlWriterPublishPartsTestCase.test_publish _______________________________________________________ self = <[AttributeError("'HtmlWriterPublishPartsTestCase' object has no attribute '_testMethodName'") raised in repr()] HtmlWriterPublishPartsTestCase object at 0x7fbd54e7e550> args = ('test_publish',), kwargs = {} def __init__(self, *args, **kwargs): if 'writer_name' in kwargs: self.writer_name = kwargs['writer_name'] del kwargs['writer_name'] > CustomTestCase.__init__(self, *args, **kwargs) E TypeError: __init__() missing 3 required positional arguments: 'input', 'expected', and 'id' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/DocutilsTestSupport.py:673: TypeError ______________________________________________________ ERROR at setup of Html5WriterPublishPartsTestCase.test_publish ______________________________________________________ self = <[AttributeError("'Html5WriterPublishPartsTestCase' object has no attribute '_testMethodName'") raised in repr()] Html5WriterPublishPartsTestCase object at 0x7fbd75348160> args = ('test_publish',), kwargs = {} def __init__(self, *args, **kwargs): if 'writer_name' in kwargs: self.writer_name = kwargs['writer_name'] del kwargs['writer_name'] > CustomTestCase.__init__(self, *args, **kwargs) E TypeError: __init__() missing 3 required positional arguments: 'input', 'expected', and 'id' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/DocutilsTestSupport.py:673: TypeError ================================================================================= FAILURES ================================================================================= _____________________________________________________________ CommandLineEncodingTests.test_sys_argv_decoding ______________________________________________________________ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, args = ['-ra', '--source-url=test.txt', '--title=Dornröschen'] values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> def parse_args(self, args=None, values=None): """ parse_args(args : [string] = sys.argv[1:], values : Values = None) -> (values : Values, args : [string]) Parse the command-line options found in 'args' (default: sys.argv[1:]). Any errors result in a call to 'error()', which by default prints the usage message to stderr and calls sys.exit() with an error message. On success returns a pair (values, args) where 'values' is a Values instance (with all your option values) and 'args' is the list of arguments left over after parsing options. """ rargs = self._get_args(args) if values is None: values = self.get_default_values() # Store the halves of the argument list as attributes for the # convenience of callbacks: # rargs # the rest of the command-line (the "r" stands for # "remaining" or "right-hand") # largs # the leftover arguments -- ie. what's left after removing # options and their arguments (the "l" stands for "leftover" # or "left-hand") self.rargs = rargs self.largs = largs = [] self.values = values try: > stop = self._process_args(largs, rargs, values) /usr/lib64/python3.8/optparse.py:1387: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, largs = [], rargs = ['--source-url=test.txt', '--title=Dornröschen'] values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> def _process_args(self, largs, rargs, values): """_process_args(largs : [string], rargs : [string], values : Values) Process command-line arguments and populate 'values', consuming options and arguments from 'rargs'. If 'allow_interspersed_args' is false, stop at the first non-option argument. If true, accumulate any interspersed non-option arguments in 'largs'. """ while rargs: arg = rargs[0] # We handle bare "--" explicitly, and bare "-" is handled by the # standard arg handler since the short arg case ensures that the # len of the opt string is greater than 1. if arg == "--": del rargs[0] return elif arg[0:2] == "--": # process a single long option (possibly with value(s)) self._process_long_opt(rargs, values) elif arg[:1] == "-" and len(arg) > 1: # process a cluster of short options (possibly with # value(s) for the last one only) > self._process_short_opts(rargs, values) /usr/lib64/python3.8/optparse.py:1431: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, rargs = ['--source-url=test.txt', '--title=Dornröschen'] values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> def _process_short_opts(self, rargs, values): arg = rargs.pop(0) stop = False i = 1 for ch in arg[1:]: opt = "-" + ch option = self._short_opt.get(opt) i += 1 # we have consumed a character if not option: raise BadOptionError(opt) if option.takes_value(): # Any characters left in arg? Pretend they're the # next arg, and stop consuming characters of arg. if i < len(arg): rargs.insert(0, arg[i:]) stop = True nargs = option.nargs if len(rargs) < nargs: self.error(ngettext( "%(option)s option requires %(number)d argument", "%(option)s option requires %(number)d arguments", nargs) % {"option": opt, "number": nargs}) elif nargs == 1: value = rargs.pop(0) else: value = tuple(rargs[0:nargs]) del rargs[0:nargs] else: # option doesn't take a value value = None > option.process(opt, value, values, self) /usr/lib64/python3.8/optparse.py:1536: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> parser = <docutils.frontend.OptionParser object at 0x7fbd54bba550> def process(self, opt, value, values, parser): """ Call the validator function on applicable settings and evaluate the 'overrides' option. Extends `optparse.Option.process`. """ > result = optparse.Option.process(self, opt, value, values, parser) /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/frontend.py:354: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> parser = <docutils.frontend.OptionParser object at 0x7fbd54bba550> def process(self, opt, value, values, parser): # First, convert the value(s) to the right type. Howl if any # value(s) are bogus. > value = self.convert_value(opt, value) /usr/lib64/python3.8/optparse.py:779: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' def convert_value(self, opt, value): if value is not None: if self.nargs == 1: > return self.check_value(opt, value) /usr/lib64/python3.8/optparse.py:771: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' def check_value(self, opt, value): checker = self.TYPE_CHECKER.get(self.type) if checker is None: return value else: > return checker(self, opt, value) /usr/lib64/python3.8/optparse.py:766: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ option = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' def check_choice(option, opt, value): if value in option.choices: return value else: choices = ", ".join(map(repr, option.choices)) > raise OptionValueError( _("option %s: invalid choice: %r (choose from %s)") % (opt, value, choices)) E optparse.OptionValueError: option -r: invalid choice: 'a' (choose from 'info', '1', 'warning', '2', 'error', '3', 'severe', '4', 'none', '5') /usr/lib64/python3.8/optparse.py:440: OptionValueError During handling of the above exception, another exception occurred: self = <test_command_line.CommandLineEncodingTests testMethod=test_sys_argv_decoding> def test_sys_argv_decoding(self): if argv_encoding == 'ascii': # cannot test return sys.argv.append('--source-url=test.txt') # pure ASCII argument if sys.version_info < (3, 0): sys.argv.append(u'--title=Dornröschen'.encode(argv_encoding)) else: sys.argv.append(u'--title=Dornröschen') publisher = docutils.core.Publisher() > publisher.process_command_line() /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_command_line.py:41: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:162: in process_command_line self.settings = option_parser.parse_args(argv) /usr/lib64/python3.8/optparse.py:1389: in parse_args self.error(str(err)) /usr/lib64/python3.8/optparse.py:1569: in error self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, status = 2 msg = "pytest: error: option -r: invalid choice: 'a' (choose from 'info', '1', 'warning', '2', 'error', '3', 'severe', '4', 'none', '5')\n" def exit(self, status=0, msg=None): if msg: sys.stderr.write(msg) > sys.exit(status) E SystemExit: 2 /usr/lib64/python3.8/optparse.py:1559: SystemExit --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- Usage ===== pytest [options] pytest: error: option -r: invalid choice: 'a' (choose from 'info', '1', 'warning', '2', 'error', '3', 'severe', '4', 'none', '5') ________________________________________________________________ reCommonMarkParserTests.test_parsing_error ________________________________________________________________ self = <test_parsers.test_recommonmark.test_misc.reCommonMarkParserTests testMethod=test_parsing_error> @unittest.skipUnless(recommonmark_wrapper.CommonMarkParser, skip_msg) def test_parsing_error(self): > output = publish_string(sample1, parser_name='recommonmark', settings_overrides={'warning_stream': ''}) /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_misc.py:55: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:407: in publish_string output, pub = publish_programmatically( /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:665: in publish_programmatically output = pub.publish(enable_exit_status=enable_exit_status) /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:217: in publish self.document = self.reader.read(self.source, self.parser, /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/readers/__init__.py:72: in read self.parse() /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/readers/__init__.py:78: in parse self.parser.parse(self.input, document) /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/parsers/recommonmark_wrapper.py:117: in parse if node['level'] != section_level: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <section "title": <title...><paragraph...>>, key = 'level' def __getitem__(self, key): if isinstance(key, basestring): > return self.attributes[key] E KeyError: 'level' /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/nodes.py:652: KeyError ============================================================================= warnings summary ============================================================================= test/test_parsers/test_recommonmark/test_section_headers.py:37 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_section_headers.py:37: DeprecationWarning: invalid escape sequence \ """\ test/test_parsers/test_recommonmark/test_section_headers.py:50 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_section_headers.py:50: DeprecationWarning: invalid escape sequence \ """\ test/test_parsers/test_recommonmark/test_section_headers.py:164 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_section_headers.py:164: DeprecationWarning: invalid escape sequence \ """\ test/test_transforms/test___init__.py:20 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_transforms/test___init__.py:20: PytestCollectionWarning: cannot collect test class 'TestTransform' because it has a __init__ constructor (from: test/test_transforms/test___init__.py) class TestTransform(transforms.Transform): test/test_settings.py::ConfigFileTests::test_old test/test_settings.py::ConfigFileTests::test_old_and_new test/test_settings.py::ConfigEnvVarFileTests::test_old_and_new test/test_settings.py::ConfigEnvVarFileTests::test_old /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/data/config_old.txt:0: ConfigDeprecationWarning: The "[option]" section is deprecated. Support for old-format configuration files may be removed in a future Docutils release. Please revise your configuration files. See <http://docutils.sf.net/docs/user/config.html>, section "Old-Format Configuration Files". test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_raw_disabled_inline test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_raw_disabled test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_parsing_error /usr/lib/python3.8/site-packages/recommonmark/parser.py:75: UserWarning: Container node skipped: type=document warn("Container node skipped: type={0}".format(mdnode.t)) -- Docs: https://docs.pytest.org/en/stable/warnings.html ========================================================================= short test summary info ========================================================================== SKIPPED [1] test/test_parsers/test_recommonmark/test_misc.py:91: recommonmark_wrapper: parser found, fallback not used ERROR test/test_functional.py::FunctionalTestCase::test - KeyError: 'configfile' ERROR test/test_language.py::LanguageTestCase::test_directives - KeyError: 'language' ERROR test/test_language.py::LanguageTestCase::test_roles - KeyError: 'language' ERROR test/test_language.py::LanguageTestCase::test_bibliographic_fields - KeyError: 'language' ERROR test/test_language.py::LanguageTestCase::test_labels - KeyError: 'language' ERROR test/test_writers/test_html5_polyglot_parts.py::HtmlWriterPublishPartsTestCase::test_publish - TypeError: __init__() missing 3 required positional arguments: 'inpu... ERROR test/test_writers/test_html5_polyglot_parts.py::Html5WriterPublishPartsTestCase::test_publish - TypeError: __init__() missing 3 required positional arguments: 'inp... FAILED test/test_command_line.py::CommandLineEncodingTests::test_sys_argv_decoding - SystemExit: 2 FAILED test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_parsing_error - KeyError: 'level' ===================================================== 2 failed, 229 passed, 1 skipped, 11 warnings, 7 errors in 10.64s ===================================================== ~~~ --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/feature-requests/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/feature-requests/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: Adam T. <aa-...@us...> - 2022-11-10 17:11:06
|
With [r9237] the test-suite refactoring project is complete -- using `pytest` and `python -m unittest` now work "out-of-the-box". A --- ** [feature-requests:#81] 0.17.1: pytest is failing** **Status:** open **Group:** Default **Created:** Sun Jun 27, 2021 03:07 AM UTC by Tomasz Kłoczko **Last Updated:** Fri Jan 14, 2022 01:33 PM UTC **Owner:** nobody Just normal build, install and test cycle used on building package from non-root account: - "setup.py build" - "setup.py install --root </install/prefix>" - "pytest with PYTHONPATH pointing to setearch and sitelib inside </install/prefix> ~~~ + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + PYTHONDONTWRITEBYTECODE=1 + /usr/bin/pytest -ra =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000) Using --randomly-seed=2664516846 rootdir: /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1 plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, httpbin-1.0.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, cases-3.6.1, flaky-3.7.0, hypothesis-6.14.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, randomly-3.8.0, Faker-8.8.2, datadir-1.3.1, regressions-2.2.0 collected 240 items test/test_statemachine.py ................. [ 7%] test/test_functional.py E [ 7%] test/test_dependencies.py ..... [ 9%] test/test_parsers/test_get_parser_class.py ... [ 10%] test/test_writers/test_latex2e_misc.py . [ 11%] test/test_publisher.py .... [ 12%] test/test_writers/test_get_writer_class.py ... [ 14%] test/test__init__.py .. [ 15%] . . [ 15%] test/test__init__.py ...... [ 17%] test/test_settings.py ........................ [ 28%] test/test_writers/test_docutils_xml.py ..... [ 30%] test/test_parsers/test_parser.py . [ 30%] test/test_transforms/test___init__.py . [ 30%] test/test_language.py EEEE [ 32%] test/test_traversals.py . [ 33%] test/test_writers/test_odt.py .......... [ 37%] test/test_command_line.py F [ 37%] test/test_writers/test_html5_polyglot_parts.py EE [ 38%] test/test_nodes.py ............................... [ 51%] test/test_writers/test_html5_polyglot_misc.py ............... [ 57%] test/test_pickle.py . [ 58%] tools/test/test_buildhtml.py .. [ 58%] test/test_io.py ................. [ 66%] test/test_readers/test_get_reader_class.py ... [ 67%] test/test_error_reporting.py ............. [ 72%] test/test_writers/test_html4css1_misc.py ............... [ 79%] test/test_parsers/test_rst/test_directives/test_code_parsing.py .. [ 79%] test/test_utils.py ........................ [ 89%] test/test_parsers/test_recommonmark/test_misc.py ..Fs [ 91%] test/test_parsers/test_rst/test_directives/test__init__.py .... [ 93%] test/test_viewlist.py ................ [100%] ================================================================================== ERRORS ================================================================================== ________________________________________________________________ ERROR at setup of FunctionalTestCase.test _________________________________________________________________ self = <[AttributeError("'FunctionalTestCase' object has no attribute '_testMethodName'") raised in repr()] FunctionalTestCase object at 0x7fbd75666df0>, args = ('test',) kwargs = {} def __init__(self, *args, **kwargs): """Set self.configfile, pass arguments to parent __init__.""" > self.configfile = kwargs['configfile'] E KeyError: 'configfile' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_functional.py:95: KeyError ____________________________________________________________ ERROR at setup of LanguageTestCase.test_directives ____________________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd754ce0d0> args = ('test_directives',), kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError ______________________________________________________________ ERROR at setup of LanguageTestCase.test_roles _______________________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd753f98b0>, args = ('test_roles',) kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError _______________________________________________________ ERROR at setup of LanguageTestCase.test_bibliographic_fields _______________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd753c4850> args = ('test_bibliographic_fields',), kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError ______________________________________________________________ ERROR at setup of LanguageTestCase.test_labels ______________________________________________________________ self = <[AttributeError("'LanguageTestCase' object has no attribute '_testMethodName'") raised in repr()] LanguageTestCase object at 0x7fbd754181f0> args = ('test_labels',), kwargs = {} def __init__(self, *args, **kwargs): self.ref = docutils.languages.get_language(reference_language, _reporter) > self.language = kwargs['language'] E KeyError: 'language' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_language.py:81: KeyError ______________________________________________________ ERROR at setup of HtmlWriterPublishPartsTestCase.test_publish _______________________________________________________ self = <[AttributeError("'HtmlWriterPublishPartsTestCase' object has no attribute '_testMethodName'") raised in repr()] HtmlWriterPublishPartsTestCase object at 0x7fbd54e7e550> args = ('test_publish',), kwargs = {} def __init__(self, *args, **kwargs): if 'writer_name' in kwargs: self.writer_name = kwargs['writer_name'] del kwargs['writer_name'] > CustomTestCase.__init__(self, *args, **kwargs) E TypeError: __init__() missing 3 required positional arguments: 'input', 'expected', and 'id' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/DocutilsTestSupport.py:673: TypeError ______________________________________________________ ERROR at setup of Html5WriterPublishPartsTestCase.test_publish ______________________________________________________ self = <[AttributeError("'Html5WriterPublishPartsTestCase' object has no attribute '_testMethodName'") raised in repr()] Html5WriterPublishPartsTestCase object at 0x7fbd75348160> args = ('test_publish',), kwargs = {} def __init__(self, *args, **kwargs): if 'writer_name' in kwargs: self.writer_name = kwargs['writer_name'] del kwargs['writer_name'] > CustomTestCase.__init__(self, *args, **kwargs) E TypeError: __init__() missing 3 required positional arguments: 'input', 'expected', and 'id' /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/DocutilsTestSupport.py:673: TypeError ================================================================================= FAILURES ================================================================================= _____________________________________________________________ CommandLineEncodingTests.test_sys_argv_decoding ______________________________________________________________ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, args = ['-ra', '--source-url=test.txt', '--title=Dornröschen'] values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> def parse_args(self, args=None, values=None): """ parse_args(args : [string] = sys.argv[1:], values : Values = None) -> (values : Values, args : [string]) Parse the command-line options found in 'args' (default: sys.argv[1:]). Any errors result in a call to 'error()', which by default prints the usage message to stderr and calls sys.exit() with an error message. On success returns a pair (values, args) where 'values' is a Values instance (with all your option values) and 'args' is the list of arguments left over after parsing options. """ rargs = self._get_args(args) if values is None: values = self.get_default_values() # Store the halves of the argument list as attributes for the # convenience of callbacks: # rargs # the rest of the command-line (the "r" stands for # "remaining" or "right-hand") # largs # the leftover arguments -- ie. what's left after removing # options and their arguments (the "l" stands for "leftover" # or "left-hand") self.rargs = rargs self.largs = largs = [] self.values = values try: > stop = self._process_args(largs, rargs, values) /usr/lib64/python3.8/optparse.py:1387: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, largs = [], rargs = ['--source-url=test.txt', '--title=Dornröschen'] values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> def _process_args(self, largs, rargs, values): """_process_args(largs : [string], rargs : [string], values : Values) Process command-line arguments and populate 'values', consuming options and arguments from 'rargs'. If 'allow_interspersed_args' is false, stop at the first non-option argument. If true, accumulate any interspersed non-option arguments in 'largs'. """ while rargs: arg = rargs[0] # We handle bare "--" explicitly, and bare "-" is handled by the # standard arg handler since the short arg case ensures that the # len of the opt string is greater than 1. if arg == "--": del rargs[0] return elif arg[0:2] == "--": # process a single long option (possibly with value(s)) self._process_long_opt(rargs, values) elif arg[:1] == "-" and len(arg) > 1: # process a cluster of short options (possibly with # value(s) for the last one only) > self._process_short_opts(rargs, values) /usr/lib64/python3.8/optparse.py:1431: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, rargs = ['--source-url=test.txt', '--title=Dornröschen'] values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> def _process_short_opts(self, rargs, values): arg = rargs.pop(0) stop = False i = 1 for ch in arg[1:]: opt = "-" + ch option = self._short_opt.get(opt) i += 1 # we have consumed a character if not option: raise BadOptionError(opt) if option.takes_value(): # Any characters left in arg? Pretend they're the # next arg, and stop consuming characters of arg. if i < len(arg): rargs.insert(0, arg[i:]) stop = True nargs = option.nargs if len(rargs) < nargs: self.error(ngettext( "%(option)s option requires %(number)d argument", "%(option)s option requires %(number)d arguments", nargs) % {"option": opt, "number": nargs}) elif nargs == 1: value = rargs.pop(0) else: value = tuple(rargs[0:nargs]) del rargs[0:nargs] else: # option doesn't take a value value = None > option.process(opt, value, values, self) /usr/lib64/python3.8/optparse.py:1536: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> parser = <docutils.frontend.OptionParser object at 0x7fbd54bba550> def process(self, opt, value, values, parser): """ Call the validator function on applicable settings and evaluate the 'overrides' option. Extends `optparse.Option.process`. """ > result = optparse.Option.process(self, opt, value, values, parser) /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/frontend.py:354: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' values = <Values at 0x7fbd54bba2e0: {'title': None, 'generator': True, 'datestamp': "%Y-%m-%d %H:%M UTC (If you see this in tes..._visitor': None, '_disable_config': None, '_source': None, '_destination': None, '_config_files': ['./docutils.conf']}> parser = <docutils.frontend.OptionParser object at 0x7fbd54bba550> def process(self, opt, value, values, parser): # First, convert the value(s) to the right type. Howl if any # value(s) are bogus. > value = self.convert_value(opt, value) /usr/lib64/python3.8/optparse.py:779: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' def convert_value(self, opt, value): if value is not None: if self.nargs == 1: > return self.check_value(opt, value) /usr/lib64/python3.8/optparse.py:771: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' def check_value(self, opt, value): checker = self.TYPE_CHECKER.get(self.type) if checker is None: return value else: > return checker(self, opt, value) /usr/lib64/python3.8/optparse.py:766: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ option = <Option at 0x7fbd54edfd90: -r/--report>, opt = '-r', value = 'a' def check_choice(option, opt, value): if value in option.choices: return value else: choices = ", ".join(map(repr, option.choices)) > raise OptionValueError( _("option %s: invalid choice: %r (choose from %s)") % (opt, value, choices)) E optparse.OptionValueError: option -r: invalid choice: 'a' (choose from 'info', '1', 'warning', '2', 'error', '3', 'severe', '4', 'none', '5') /usr/lib64/python3.8/optparse.py:440: OptionValueError During handling of the above exception, another exception occurred: self = <test_command_line.CommandLineEncodingTests testMethod=test_sys_argv_decoding> def test_sys_argv_decoding(self): if argv_encoding == 'ascii': # cannot test return sys.argv.append('--source-url=test.txt') # pure ASCII argument if sys.version_info < (3, 0): sys.argv.append(u'--title=Dornröschen'.encode(argv_encoding)) else: sys.argv.append(u'--title=Dornröschen') publisher = docutils.core.Publisher() > publisher.process_command_line() /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_command_line.py:41: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:162: in process_command_line self.settings = option_parser.parse_args(argv) /usr/lib64/python3.8/optparse.py:1389: in parse_args self.error(str(err)) /usr/lib64/python3.8/optparse.py:1569: in error self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg)) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <docutils.frontend.OptionParser object at 0x7fbd54bba550>, status = 2 msg = "pytest: error: option -r: invalid choice: 'a' (choose from 'info', '1', 'warning', '2', 'error', '3', 'severe', '4', 'none', '5')\n" def exit(self, status=0, msg=None): if msg: sys.stderr.write(msg) > sys.exit(status) E SystemExit: 2 /usr/lib64/python3.8/optparse.py:1559: SystemExit --------------------------------------------------------------------------- Captured stderr call --------------------------------------------------------------------------- Usage ===== pytest [options] pytest: error: option -r: invalid choice: 'a' (choose from 'info', '1', 'warning', '2', 'error', '3', 'severe', '4', 'none', '5') ________________________________________________________________ reCommonMarkParserTests.test_parsing_error ________________________________________________________________ self = <test_parsers.test_recommonmark.test_misc.reCommonMarkParserTests testMethod=test_parsing_error> @unittest.skipUnless(recommonmark_wrapper.CommonMarkParser, skip_msg) def test_parsing_error(self): > output = publish_string(sample1, parser_name='recommonmark', settings_overrides={'warning_stream': ''}) /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_misc.py:55: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:407: in publish_string output, pub = publish_programmatically( /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:665: in publish_programmatically output = pub.publish(enable_exit_status=enable_exit_status) /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/core.py:217: in publish self.document = self.reader.read(self.source, self.parser, /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/readers/__init__.py:72: in read self.parse() /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/readers/__init__.py:78: in parse self.parser.parse(self.input, document) /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/parsers/recommonmark_wrapper.py:117: in parse if node['level'] != section_level: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <section "title": <title...><paragraph...>>, key = 'level' def __getitem__(self, key): if isinstance(key, basestring): > return self.attributes[key] E KeyError: 'level' /home/tkloczko/rpmbuild/BUILDROOT/python-docutils-0.17.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/docutils/nodes.py:652: KeyError ============================================================================= warnings summary ============================================================================= test/test_parsers/test_recommonmark/test_section_headers.py:37 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_section_headers.py:37: DeprecationWarning: invalid escape sequence \ """\ test/test_parsers/test_recommonmark/test_section_headers.py:50 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_section_headers.py:50: DeprecationWarning: invalid escape sequence \ """\ test/test_parsers/test_recommonmark/test_section_headers.py:164 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_parsers/test_recommonmark/test_section_headers.py:164: DeprecationWarning: invalid escape sequence \ """\ test/test_transforms/test___init__.py:20 /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/test_transforms/test___init__.py:20: PytestCollectionWarning: cannot collect test class 'TestTransform' because it has a __init__ constructor (from: test/test_transforms/test___init__.py) class TestTransform(transforms.Transform): test/test_settings.py::ConfigFileTests::test_old test/test_settings.py::ConfigFileTests::test_old_and_new test/test_settings.py::ConfigEnvVarFileTests::test_old_and_new test/test_settings.py::ConfigEnvVarFileTests::test_old /home/tkloczko/rpmbuild/BUILD/docutils-0.17.1/test/data/config_old.txt:0: ConfigDeprecationWarning: The "[option]" section is deprecated. Support for old-format configuration files may be removed in a future Docutils release. Please revise your configuration files. See <http://docutils.sf.net/docs/user/config.html>, section "Old-Format Configuration Files". test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_raw_disabled_inline test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_raw_disabled test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_parsing_error /usr/lib/python3.8/site-packages/recommonmark/parser.py:75: UserWarning: Container node skipped: type=document warn("Container node skipped: type={0}".format(mdnode.t)) -- Docs: https://docs.pytest.org/en/stable/warnings.html ========================================================================= short test summary info ========================================================================== SKIPPED [1] test/test_parsers/test_recommonmark/test_misc.py:91: recommonmark_wrapper: parser found, fallback not used ERROR test/test_functional.py::FunctionalTestCase::test - KeyError: 'configfile' ERROR test/test_language.py::LanguageTestCase::test_directives - KeyError: 'language' ERROR test/test_language.py::LanguageTestCase::test_roles - KeyError: 'language' ERROR test/test_language.py::LanguageTestCase::test_bibliographic_fields - KeyError: 'language' ERROR test/test_language.py::LanguageTestCase::test_labels - KeyError: 'language' ERROR test/test_writers/test_html5_polyglot_parts.py::HtmlWriterPublishPartsTestCase::test_publish - TypeError: __init__() missing 3 required positional arguments: 'inpu... ERROR test/test_writers/test_html5_polyglot_parts.py::Html5WriterPublishPartsTestCase::test_publish - TypeError: __init__() missing 3 required positional arguments: 'inp... FAILED test/test_command_line.py::CommandLineEncodingTests::test_sys_argv_decoding - SystemExit: 2 FAILED test/test_parsers/test_recommonmark/test_misc.py::reCommonMarkParserTests::test_parsing_error - KeyError: 'level' ===================================================== 2 failed, 229 passed, 1 skipped, 11 warnings, 7 errors in 10.64s ===================================================== ~~~ --- Sent from sourceforge.net because doc...@li... is subscribed to https://sourceforge.net/p/docutils/feature-requests/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/feature-requests/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: Guenter M. <mi...@us...> - 2022-11-10 15:17:30
|
Only add warnigns to core functions, if users can avoid this warnings following a recommended practice. For core API functions and classes: don't change the behaviour but replace with new function(s) showing new behaviour. This way users can switch to the new behaviour at some stage during the transition period. Add a deprecation warning once the new functions are in place. # Suggestion for the next step to solve the "string I/O" problem. # OK to commit? --- docutils/docutils/core.py | 2 -- docutils/docutils/io.py | 27 +++++++++++++-------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/docutils/docutils/core.py b/docutils/docutils/core.py index a54ed7a90..edbcfc3df 100644 --- a/docutils/docutils/core.py +++ b/docutils/docutils/core.py @@ -443,8 +443,6 @@ def publish_string(source, source_path=None, destination_path=None, Parameters: see `publish_programmatically`. """ - warnings.warn('The return type of publish_string will change to ' - '"str" from Docutils 0.21.', FutureWarning, stacklevel=2) output, pub = publish_programmatically( source_class=io.StringInput, source=source, source_path=source_path, destination_class=io.StringOutput, diff --git a/docutils/docutils/io.py b/docutils/docutils/io.py index 53e93886a..12342025d 100644 --- a/docutils/docutils/io.py +++ b/docutils/docutils/io.py @@ -247,6 +247,11 @@ class Output(TransformSpec): raise NotImplementedError def encode(self, data): + """Encode `data` with `self.encoding` (unless it is already encoded). + + If `self.encoding` is set to the pseudo encoding name "unicode", + `data` must be a `str` instance and is returned unchanged. + """ if self.encoding and self.encoding.lower() == 'unicode': assert isinstance(data, str), ( 'the encoding given is "unicode" but the output is not ' @@ -581,7 +586,7 @@ class StringInput(Input): default_source_path = '<string>' def read(self): - """Return the source as `str` instance. + """Return the source as `str` object. Decode, if required (see `Input.decode`). """ @@ -589,26 +594,20 @@ class StringInput(Input): class StringOutput(Output): - - """ - Direct string output. - """ + """Output to a `bytes` or `str` instance.""" default_destination_path = '<string>' def write(self, data): - """Encode `data`, store it in `self.destination`, and return it.""" + """Encode `data`, store it in `self.destination`, and return it. + + If `self.encoding` is set to the pseudo encoding name "unicode", + `data` must be a `str` instance and is returned unchanged. + (cf. `Output.encode`) + """ self.destination = self.encode(data) return self.destination - def encode(self, data): - data = super().encode(data) - if not isinstance(data, str): - warnings.warn("StringOutput.encode()'s return type will change to " - f'``str`` from Docutils 0.21, got type {type(data)}', - FutureWarning, stacklevel=2) - return data - class NullInput(Input): -- 2.30.2 |