question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

2.2.1: pytest based test suite is failing

See original GitHub issue

IMO it would be good to fix pytest support as pytest has a bit shorter list of dependencies than tox.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-soupsieve-2.2.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-soupsieve-2.2.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/python3 -Bm pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.8, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/tkloczko/rpmbuild/BUILD/soupsieve-2.2.1, configfile: tox.ini
plugins: flaky-3.6.1, forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, asyncio-0.14.0, expect-1.1.0, cov-2.11.1, mock-3.5.1, httpbin-1.0.0, xdist-2.2.1, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, hypothesis-6.8.1, pyfakefs-4.4.0, freezegun-0.4.2
collected 360 items

tests/test_api.py ..........................................                                                                                                         [ 11%]
tests/test_bs4_cases.py .....                                                                                                                                        [ 13%]
tests/test_versions.py ....                                                                                                                                          [ 14%]
tests/test_extra/test_attribute.py ...                                                                                                                               [ 15%]
tests/test_extra/test_custom.py ..........                                                                                                                           [ 17%]
tests/test_extra/test_soup_contains.py ..F...............                                                                                                            [ 22%]
tests/test_extra/test_soup_contains_own.py .F...                                                                                                                     [ 24%]
tests/test_level1/test_active.py .                                                                                                                                   [ 24%]
tests/test_level1/test_at_rule.py .                                                                                                                                  [ 24%]
tests/test_level1/test_class.py ........                                                                                                                             [ 26%]
tests/test_level1/test_comments.py ..                                                                                                                                [ 27%]
tests/test_level1/test_descendant.py .                                                                                                                               [ 27%]
tests/test_level1/test_escapes.py .                                                                                                                                  [ 28%]
tests/test_level1/test_id.py ...                                                                                                                                     [ 28%]
tests/test_level1/test_link.py ..                                                                                                                                    [ 29%]
tests/test_level1/test_list.py ....                                                                                                                                  [ 30%]
tests/test_level1/test_pseudo_class.py ..                                                                                                                            [ 31%]
tests/test_level1/test_pseudo_element.py .                                                                                                                           [ 31%]
tests/test_level1/test_type.py .....                                                                                                                                 [ 32%]
tests/test_level1/test_visited.py .                                                                                                                                  [ 33%]
tests/test_level2/test_attribute.py ..............................                                                                                                   [ 41%]
tests/test_level2/test_child.py .....                                                                                                                                [ 42%]
tests/test_level2/test_first_child.py .                                                                                                                              [ 43%]
tests/test_level2/test_focus.py ..                                                                                                                                   [ 43%]
tests/test_level2/test_hover.py .                                                                                                                                    [ 43%]
tests/test_level2/test_lang.py ..                                                                                                                                    [ 44%]
tests/test_level2/test_next_sibling.py ...                                                                                                                           [ 45%]
tests/test_level2/test_universal_type.py .                                                                                                                           [ 45%]
tests/test_level3/test_attribute.py ...                                                                                                                              [ 46%]
tests/test_level3/test_checked.py .                                                                                                                                  [ 46%]
tests/test_level3/test_disabled.py .......                                                                                                                           [ 48%]
tests/test_level3/test_empty.py .                                                                                                                                    [ 48%]
tests/test_level3/test_enabled.py ......                                                                                                                             [ 50%]
tests/test_level3/test_first_of_type.py ...                                                                                                                          [ 51%]
tests/test_level3/test_last_child.py ..                                                                                                                              [ 51%]
tests/test_level3/test_last_of_type.py ...                                                                                                                           [ 52%]
tests/test_level3/test_namespace.py ..............                                                                                                                   [ 56%]
tests/test_level3/test_not.py ....                                                                                                                                   [ 57%]
tests/test_level3/test_nth_child.py ......                                                                                                                           [ 59%]
tests/test_level3/test_nth_last_child.py ..                                                                                                                          [ 60%]
tests/test_level3/test_nth_last_of_type.py ..                                                                                                                        [ 60%]
tests/test_level3/test_nth_of_type.py ..                                                                                                                             [ 61%]
tests/test_level3/test_only_child.py .                                                                                                                               [ 61%]
tests/test_level3/test_only_of_type.py .                                                                                                                             [ 61%]
tests/test_level3/test_root.py ...........                                                                                                                           [ 64%]
tests/test_level3/test_subsequent_sibling.py .                                                                                                                       [ 65%]
tests/test_level3/test_target.py ..                                                                                                                                  [ 65%]
tests/test_level4/test_any_link.py ....                                                                                                                              [ 66%]
tests/test_level4/test_attribute.py .....                                                                                                                            [ 68%]
tests/test_level4/test_current.py ....                                                                                                                               [ 69%]
tests/test_level4/test_default.py .....                                                                                                                              [ 70%]
tests/test_level4/test_defined.py ..                                                                                                                                 [ 71%]
tests/test_level4/test_dir.py ...........                                                                                                                            [ 74%]
tests/test_level4/test_focus_visible.py ..                                                                                                                           [ 74%]
tests/test_level4/test_focus_within.py ..                                                                                                                            [ 75%]
tests/test_level4/test_future.py ..                                                                                                                                  [ 75%]
tests/test_level4/test_has.py ..............                                                                                                                         [ 79%]
tests/test_level4/test_host.py ..                                                                                                                                    [ 80%]
tests/test_level4/test_host_context.py .                                                                                                                             [ 80%]
tests/test_level4/test_in_range.py .......                                                                                                                           [ 82%]
tests/test_level4/test_indeterminate.py ..                                                                                                                           [ 83%]
tests/test_level4/test_is.py ........                                                                                                                                [ 85%]
tests/test_level4/test_lang.py ..................                                                                                                                    [ 90%]
tests/test_level4/test_local_link.py ..                                                                                                                              [ 90%]
tests/test_level4/test_matches.py ..                                                                                                                                 [ 91%]
tests/test_level4/test_not.py .                                                                                                                                      [ 91%]
tests/test_level4/test_nth_child.py ..                                                                                                                               [ 92%]
tests/test_level4/test_optional.py ..                                                                                                                                [ 92%]
tests/test_level4/test_out_of_range.py .......                                                                                                                       [ 94%]
tests/test_level4/test_past.py ..                                                                                                                                    [ 95%]
tests/test_level4/test_paused.py ..                                                                                                                                  [ 95%]
tests/test_level4/test_placeholder_shown.py .                                                                                                                        [ 96%]
tests/test_level4/test_playing.py ..                                                                                                                                 [ 96%]
tests/test_level4/test_read_only.py .                                                                                                                                [ 96%]
tests/test_level4/test_read_write.py .                                                                                                                               [ 97%]
tests/test_level4/test_required.py ..                                                                                                                                [ 97%]
tests/test_level4/test_scope.py ...                                                                                                                                  [ 98%]
tests/test_level4/test_target_within.py ..                                                                                                                           [ 99%]
tests/test_level4/test_user_invalid.py .                                                                                                                             [ 99%]
tests/test_level4/test_where.py ..                                                                                                                                   [100%]

================================================================================= FAILURES =================================================================================
________________________________________________________________ TestSoupContains.test_contains_cdata_html _________________________________________________________________

self = <tests.test_extra.test_soup_contains.TestSoupContains testMethod=test_contains_cdata_html>

    def test_contains_cdata_html(self):
        """Test contains CDATA in HTML5."""

        markup = """
        <body><div id="1">Testing that <span id="2"><![CDATA[that]]></span>contains works.</div></body>
        """

>       self.assert_selector(
            markup,
            'body *:-soup-contains("that")',
            ['1'],
            flags=util.HTML
        )

tests/test_extra/test_soup_contains.py:154:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/util.py:122: in assert_selector
    self.assertEqual(sorted(ids), sorted(expected_ids))
E   AssertionError: Lists differ: ['1', '2'] != ['1']
E
E   First list contains 1 additional elements.
E   First extra element 1:
E   '2'
E
E   - ['1', '2']
E   + ['1']
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
----Running Selector Test----
PATTERN:  body *:-soup-contains("that")
## PARSING: 'body *:-soup-contains("that")'
TOKEN: 'tag' --> 'body' at position 0
TOKEN: 'combine' --> ' ' at position 4
TOKEN: 'tag' --> '*' at position 5
TOKEN: 'pseudo_contains' --> ':-soup-contains("that")' at position 6
## END PARSING

====PARSER:  html5lib
TAG:  div

====PARSER:  lxml
TAG:  div
TAG:  span
_____________________________________________________________ TestSoupContainsOwn.test_contains_own_cdata_html _____________________________________________________________

self = <tests.test_extra.test_soup_contains_own.TestSoupContainsOwn testMethod=test_contains_own_cdata_html>

    def test_contains_own_cdata_html(self):
        """Test contains CDATA in HTML5."""

        markup = """
        <body><div id="1">Testing that <span id="2"><![CDATA[that]]></span>contains works.</div></body>
        """

>       self.assert_selector(
            markup,
            'body *:-soup-contains-own("that")',
            ['1'],
            flags=util.HTML
        )

tests/test_extra/test_soup_contains_own.py:45:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/util.py:122: in assert_selector
    self.assertEqual(sorted(ids), sorted(expected_ids))
E   AssertionError: Lists differ: ['1', '2'] != ['1']
E
E   First list contains 1 additional elements.
E   First extra element 1:
E   '2'
E
E   - ['1', '2']
E   + ['1']
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
----Running Selector Test----
PATTERN:  body *:-soup-contains-own("that")
## PARSING: 'body *:-soup-contains-own("that")'
TOKEN: 'tag' --> 'body' at position 0
TOKEN: 'combine' --> ' ' at position 4
TOKEN: 'tag' --> '*' at position 5
TOKEN: 'pseudo_contains' --> ':-soup-contains-own("that")' at position 6
## END PARSING

====PARSER:  html5lib
TAG:  div

====PARSER:  lxml
TAG:  div
TAG:  span
========================================================================= short test summary info ==========================================================================
FAILED tests/test_extra/test_soup_contains.py::TestSoupContains::test_contains_cdata_html - AssertionError: Lists differ: ['1', '2'] != ['1']
FAILED tests/test_extra/test_soup_contains_own.py::TestSoupContainsOwn::test_contains_own_cdata_html - AssertionError: Lists differ: ['1', '2'] != ['1']
====================================================================== 2 failed, 358 passed in 2.25s =======================================================================

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
facelessusercommented, Mar 20, 2021

@gir-bot add S: more-info-needed

0reactions
facelessusercommented, Apr 10, 2022

Glad its working 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

2.2.1: test suite is failing · Issue #629 · pytest-dev/pytest-xdist
Just tested 2.3.0 and looks like there is no errors now. + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pytest-xdist-2.3.0-3.
Read more >
pytest-cov - PyPI
This feature was mostly working but very broken in certain scenarios and made the test suite very flaky and slow. There is builtin...
Read more >
How to re-run failed tests and maintain state between test runs
Usage¶. The plugin provides two command line options to rerun failures from the last pytest invocation: --lf , --last-failed - to only re-run...
Read more >
Allure Framework
Here is what you get in the report if such a test failed: ... That will install allure-pytest and allure-python-commons packages to produce ......
Read more >
A Guide to Python Unit Testing with unittest and pytest
Learn what software testing is, and how to run Python unit tests with ... test case won't find a defect in the behavior...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found