Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

BeautifulSoup generating warnings during tests #52

Open
mgiuca opened this issue Feb 25, 2016 · 0 comments
Open

BeautifulSoup generating warnings during tests #52

mgiuca opened this issue Feb 25, 2016 · 0 comments

Comments

@mgiuca
Copy link
Member

mgiuca commented Feb 25, 2016

  1. ./run_tests.py py

Tests are generating this warning:

/usr/local/lib/python2.7/dist-packages/bs4/__init__.py:166: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

To get rid of this warning, change this:

 BeautifulSoup([your markup])

to this:

 BeautifulSoup([your markup], "lxml")

  markup_type=markup_type))

Most calls to BeautifulSoup pass 'html.parser' as the parser, but there are lots of calls to BeautifulSoup with no explicit parser, which is what this is warning about. We can go through and set all of them to 'html.parser'.

But the test in report_test.py, TestGenerateSummary.test_generate_summary fails if you use 'html.parser'. It passes if you use 'lxml', but this indicates a problem with the test if the choice of parser matters. And also it means we have an unspecified dependency on lxml. So this is a legitimate warning that we don't want to ignore.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant