Skip to content
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

Fix nodes._check_initialpaths_for_relpath for dirs #4352

Merged
merged 1 commit into from
Nov 10, 2018

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Nov 9, 2018

@blueyed blueyed force-pushed the _check_initialpaths_for_relpath branch from 8baeb90 to 8532756 Compare November 9, 2018 01:43
@codecov
Copy link

codecov bot commented Nov 9, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4352      +/-   ##
==========================================
+ Coverage   95.85%   95.85%   +<.01%     
==========================================
  Files         111      111              
  Lines       24895    24907      +12     
  Branches     2431     2431              
==========================================
+ Hits        23862    23874      +12     
  Misses        736      736              
  Partials      297      297
Flag Coverage Δ
#docs 28.88% <0%> (-0.02%) ⬇️
#doctesting 28.88% <0%> (-0.02%) ⬇️
#linting 28.88% <0%> (-0.02%) ⬇️
#linux 95.63% <100%> (ø) ⬆️
#nobyte 91.85% <100%> (ø) ⬆️
#numpy 93.02% <100%> (-0.01%) ⬇️
#pexpect 41.62% <0%> (-0.03%) ⬇️
#py27 94.02% <100%> (ø) ⬆️
#py34 92.16% <100%> (+0.06%) ⬆️
#py35 92.16% <100%> (+0.06%) ⬆️
#py36 93.92% <100%> (ø) ⬆️
#py37 92.21% <100%> (+0.06%) ⬆️
#trial 93.02% <100%> (-0.01%) ⬇️
#windows 93.97% <100%> (-0.01%) ⬇️
#xdist 93.73% <100%> (ø) ⬆️
Impacted Files Coverage Δ
testing/acceptance_test.py 98.27% <ø> (ø) ⬆️
testing/test_session.py 96.5% <ø> (ø) ⬆️
src/_pytest/nodes.py 94.75% <100%> (ø) ⬆️
testing/test_nodes.py 100% <100%> (ø) ⬆️

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 e00f3a2...bee72a6. Read the comment docs.

"*test_world.py::test_other*PASSED*",
"*4 passed*",
"test_hello.py::test_hello*PASSED*",
"test_hello.py::test_other*PASSED*",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before this fix there was "hello/" here.

["*rootdir: {}/root, inifile:*".format(testdir.tmpdir), "*1 passed*"]
[
"*rootdir: {}/root, inifile:*".format(testdir.tmpdir),
"root/test_rootdir_option_arg.py *",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before the fix this was root/test_rootdir_option_argX/test_rootdir_option_arg.py.

@Lekensteyn
Copy link

I can confirm that the combination of this fix (change in nodes.py) and #4337 (two changes in main.py) resolves the issue in #4321.

@@ -447,6 +447,8 @@ def _prunetraceback(self, excinfo):
def _check_initialpaths_for_relpath(session, fspath):
for initial_path in session._initialpaths:
if fspath.common(initial_path) == initial_path:
if initial_path.isdir():
return fspath.relto(initial_path)
return fspath.relto(initial_path.dirname)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And looking closer it shows that it can only really be a dir here, if it shares a / is the common path with fspath, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Amended.

Ref: pytest-dev#4321 (comment)

Hardens some of the not many tests affected by this:

1. `testing/test_session.py::test_rootdir_option_arg` displayed:

> root/test_rootdir_option_arg2/test_rootdir_option_arg.py

2. `test_cmdline_python_namespace_package` displayed "hello/" prefix for:

> hello/test_hello.py::test_hello
> hello/test_hello.py::test_other
@blueyed blueyed force-pushed the _check_initialpaths_for_relpath branch from 8532756 to bee72a6 Compare November 9, 2018 12:17
@blueyed blueyed added type: bug problem that needs to be addressed topic: collection related to the collection phase labels Nov 9, 2018
@blueyed blueyed merged commit e14ca19 into pytest-dev:master Nov 10, 2018
@blueyed blueyed deleted the _check_initialpaths_for_relpath branch November 10, 2018 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: collection related to the collection phase type: bug problem that needs to be addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants