Skip to content

Ensure that node ids are printable#4418

Merged
RonnyPfannschmidt merged 5 commits into
pytest-dev:featuresfrom
asottile:printable_ids
Nov 19, 2018
Merged

Ensure that node ids are printable#4418
RonnyPfannschmidt merged 5 commits into
pytest-dev:featuresfrom
asottile:printable_ids

Conversation

@asottile

@asottile asottile commented Nov 18, 2018

Copy link
Copy Markdown
Member

Resolves #4397

targeting features:

  • require that param(id=...) is a string
  • alter the id=... on construction when manually passed to enforce printability
  • changes the ids of parametrized bytestrings that weren't printable

@codecov

codecov Bot commented Nov 18, 2018

Copy link
Copy Markdown

Codecov Report

Merging #4418 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4418      +/-   ##
==========================================
+ Coverage   95.88%   95.89%   +<.01%     
==========================================
  Files         111      111              
  Lines       25008    25039      +31     
  Branches     2438     2441       +3     
==========================================
+ Hits        23979    24010      +31     
- Misses        725      727       +2     
+ Partials      304      302       -2
Flag Coverage Δ
#docs 30.18% <14.28%> (+0.09%) ⬆️
#doctesting 30.18% <14.28%> (+0.09%) ⬆️
#linting 30.18% <14.28%> (+0.09%) ⬆️
#linux 95.72% <100%> (ø) ⬆️
#nobyte 92.65% <89.13%> (ø) ⬆️
#numpy 93.42% <93.47%> (-0.01%) ⬇️
#pexpect 41% <31.42%> (-0.88%) ⬇️
#py27 93.03% <89.13%> (-0.98%) ⬇️
#py34 92.17% <86.95%> (+0.06%) ⬆️
#py35 92.19% <86.95%> (+0.06%) ⬆️
#py36 92.21% <86.95%> (+0.06%) ⬆️
#py37 94.1% <86.95%> (+0.01%) ⬆️
#trial 93.42% <93.47%> (-0.01%) ⬇️
#windows 94.11% <100%> (ø) ⬆️
#xdist 93.96% <100%> (ø) ⬆️
Impacted Files Coverage Δ
testing/test_mark.py 97.25% <100%> (+0.08%) ⬆️
src/_pytest/compat.py 96.96% <100%> (+0.09%) ⬆️
src/_pytest/mark/structures.py 94.73% <100%> (+0.09%) ⬆️
testing/python/metafunc.py 95.35% <100%> (+0.05%) ⬆️
src/_pytest/unittest.py 93.22% <0%> (-1.13%) ⬇️
src/_pytest/capture.py 93.42% <0%> (-0.46%) ⬇️
testing/test_pdb.py 98.77% <0%> (-0.25%) ⬇️
src/_pytest/terminal.py 92.85% <0%> (+0.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a281d66...95c6d59. Read the comment docs.

else:
escaped.decode("ascii")
assert isinstance(escaped, six.text_type)
escaped.encode("ascii")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

even with the old code its not clear what good this test does

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it's a cheeky way to say "this is encodabe / decodable with ascii"

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this looks great, we need to follow up with taking off some hacks (like the null byte converted to "(null)" in the env var

@asottile

Copy link
Copy Markdown
Member Author

@RonnyPfannschmidt @blueyed -- is this ok to go into master or should I retarget features -- the original issue is a "bug", but the fix changes behaviour so I'm on the fence

@blueyed

blueyed commented Nov 19, 2018

Copy link
Copy Markdown
Contributor

@asottile
"features" sounds better to me.

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

features please

This was documented before, but never enforced.  Passing non-strings could
have strange side-effects and enforcing a string simplifies other
implementation.
@asottile asottile changed the base branch from master to features November 19, 2018 19:04
@asottile

Copy link
Copy Markdown
Member Author

done, rebased against features

@RonnyPfannschmidt RonnyPfannschmidt merged commit 0ffb8dd into pytest-dev:features Nov 19, 2018
@asottile asottile deleted the printable_ids branch November 29, 2018 02:34
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.

3 participants