Menu

#81 Support for pytest

Default
closed-fixed
nobody
None
5
2022-11-10
2021-06-27
No

Just normal build, install and test cycle used on building package from non-root account:
- "setup.py build"
- "setup.py install --root "
- "pytest with PYTHONPATH pointing to setearch and sitelib inside

+ 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 =====================================================

Discussion

  • Günter Milde

    Günter Milde - 2021-07-05

    Ticket moved from /p/docutils/bugs/420/

    Can't be converted:

    • _milestone:
     
  • Günter Milde

    Günter Milde - 2021-07-05

    Docutils testing builds on the included batteries, there is no support for the 3rd party "pytest" framework.
    If there is interest and someone volunteering for the work, we may discuss about adding such support.

     
    • Tomasz K&#322;oczko

      Docutils testing builds on the included batteries, there is no support for the 3rd party "pytest" framework.

      docutils uses unittest module and pytest can handle unittrst units .. +/- some issues with units code which in ths case has been exposed.

      And about topic od the github/gitlab .. it would be good to migrate man VCS to one of those sites because they are offering to downlaod exact commit as patch over REST https interface. sf.net sdoes not offer that. This is extreamly useful on dowloading parches by build automation.
      In other words without such interface on top of the VCS such interraction is not possible.

       
  • Tomasz K&#322;oczko

    BTW it would be really good to migrate from svn to git and best move repo to github or gitlab because sf.net VCS frontend does not allow download exact commit as patch.

     
  • Tomasz K&#322;oczko

    BTW latest pytest shows some deprecation warnings

    ============================================================================= 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
    test/test_settings.py::ConfigEnvVarFileTests::test_old_and_new
      /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".
    
    -- Docs: https://docs.pytest.org/en/stable/warnings.html
    ========================================================================= short test summary info ==========================================================================
    SKIPPED [1] test/test_parsers/test_recommonmark/test_misc.py:81: optional module "recommonmark" not found
    SKIPPED [1] test/test_parsers/test_recommonmark/test_misc.py:70: optional module "recommonmark" not found
    ========================================================= 227 passed, 2 skipped, 9 deselected, 8 warnings in 3.28s =========================================================
    
     
    • Günter Milde

      Günter Milde - 2022-01-06

      This should be fixed in [r8933].
      Thank you for the report.

       

      Related

      Commit: [r8933]

  • Günter Milde

    Günter Milde - 2022-01-06

    See also [bugs:#441] about "optparse" DeprecationWarnings.

     

    Related

    Feature Requests: #110


    Last edit: Günter Milde 2022-01-06
  • engelbert gruber

    Hei Thomas,
    you are testing docutils-0.17.1 does this mean you require the fix on 0.17 ?

     
    • Tomasz K&#322;oczko

      I'm only reporting that pytest is failing.
      So far all my rpm packages which are using docutils are building with docutils build with disabled on testing all those failing units so I cannot tell that I need something :)
      Nevertheless probably it would be good to look closet on why those units are failing ad fix test suite or tested code :)

       
  • Günter Milde

    Günter Milde - 2022-01-07

    Thank you, Tomasz, for the reports.
    Could you re-test with a current repository check-out or snapshot and attach an error log if there are still problems?

     
  • Günter Milde

    Günter Milde - 2022-01-07

    I could reproduce with

    #> cd <repository-checkout-root>/docutils/test
    #> pytest
    ...
    ===== 238 passed, 1 skipped, 2 warnings, 7 errors in 2.08s ====
    

    I'll have a look into the issues later.

     
  • Günter Milde

    Günter Milde - 2022-01-12

    The problem is, that the Docutils test suite uses classes derived from standard unittest that add
    arguments to __init__() which makes them incompatible to the pytest (and nosetest) frameworks. This is now documented (in [r8945]).
    Besides the remaining errors, pytest also finds only 237 of the 1599 tests in the test suite.

    Running the suite as documented in https://docutils.sourceforge.io/docs/dev/testing.html works.

     

    Related

    Commit: [r8945]

  • Adam  Turner

    Adam Turner - 2022-01-12

    I've made progress on "standardising" the docutils testing setup in https://github.com/AA-Turner/docutils/tree/testing-runner

    "standardising" here means moving to the point where standard python -m unittest would work on the test/ directory. Unittest itself has also changed somewhat since the python2 days, and several of the additions docutils makes are no longer needed / superseeded by the stdlib.

    If there would be interest in adopting this work, I can finish it up and propose it as a set of clean patches.

    A

     
    • Günter Milde

      Günter Milde - 2022-01-12

      On 2022-01-12, Adam Turner wrote:

      I've made progress on "standardising" the docutils testing setup in
      https://github.com/AA-Turner/docutils/tree/testing-runner
      ...
      If there would be interest in adopting this work, I can finish it up
      and propose it as a set of clean patches.

      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.

      Thanks, Günter

       
  • Adam  Turner

    Adam Turner - 2022-01-12

    (note I'm not proposing moving to pytest -- that would have benefits, but I think should be kept as a distinct change. The work I've done would make it easier to transition, though)

     
  • Adam  Turner

    Adam Turner - 2022-11-10

    With [r9237] the test-suite refactoring project is complete -- using pytest and python -m unittest now work "out-of-the-box".

    A

     

    Related

    Commit: [r9237]

  • Adam  Turner

    Adam Turner - 2022-11-10
    • status: open --> closed-fixed
     
  • Adam  Turner

    Adam Turner - 2022-11-10
    • summary: 0.17.1: pytest is failing --> Support for pytest
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.