Skip to content

fix test_follow_whitespace_* tests #5756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 12, 2022
Merged

fix test_follow_whitespace_* tests #5756

merged 3 commits into from
Dec 12, 2022

Conversation

Laerte
Copy link
Member

@Laerte Laerte commented Dec 11, 2022

The tests are failing because after release 2.1.1, w3lib is striping spaces from url, so i add a validation to append %20 if the version that is running is minor than 2.1.1.

resolves #5750

@codecov
Copy link

codecov bot commented Dec 11, 2022

Codecov Report

Merging #5756 (e099572) into master (fe60c12) will decrease coverage by 4.10%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #5756      +/-   ##
==========================================
- Coverage   88.91%   84.81%   -4.11%     
==========================================
  Files         162      162              
  Lines       10963    10963              
  Branches     1794     1794              
==========================================
- Hits         9748     9298     -450     
- Misses        932     1394     +462     
+ Partials      283      271      -12     
Impacted Files Coverage Δ
scrapy/pipelines/images.py 26.47% <0.00%> (-70.59%) ⬇️
scrapy/core/http2/stream.py 26.58% <0.00%> (-64.74%) ⬇️
scrapy/core/http2/agent.py 36.14% <0.00%> (-60.25%) ⬇️
scrapy/core/downloader/handlers/http2.py 45.07% <0.00%> (-54.93%) ⬇️
scrapy/core/http2/protocol.py 34.17% <0.00%> (-49.25%) ⬇️
scrapy/robotstxt.py 75.30% <0.00%> (-22.23%) ⬇️
scrapy/core/downloader/contextfactory.py 75.92% <0.00%> (-11.12%) ⬇️
scrapy/utils/test.py 56.75% <0.00%> (-9.46%) ⬇️
scrapy/pipelines/media.py 92.90% <0.00%> (-5.68%) ⬇️
scrapy/squeues.py 95.45% <0.00%> (-4.55%) ⬇️
... and 2 more

Copy link
Member

@Gallaecio Gallaecio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old behavior is a bug.

For example, if you open the following HTML file in Chromium or Firefox, both links point to the same URL, because the contents of the href attribute are parsed according to the URL living standard, which mandates stripping certain characters before even parsing the URL.

<a href="foo">Without a space</a><br/>
<a href="foo ">With a space</a>

So, rather than changing expectations, I would use a conditional, strict xfail instead. e.g.

@pytest.mark.xfail(
    parse_version(w3lib_version) < parse_version("2.1.1"),
    reason="https://github.com/scrapy/w3lib/pull/207",
    strict=True,
)

No strong opinion though, I am OK with merging as is.

PS: From what I can tell, all remaining CI errors are unrelated to this change.

@wRAR wRAR merged commit 26ebdbf into scrapy:master Dec 12, 2022
@Laerte Laerte deleted the fix-test_follow_whitespace-tests branch December 12, 2022 18:56
holymonson added a commit to holymonson/scrapy-feedstock that referenced this pull request Jan 3, 2023
Should be released after scrapy/scrapy#5756 released.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_follow_whitespace_* tests broken by new w3lib
3 participants