Change directory for py27 xdist-related envs #2874
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
filter_traceback
function was not filtering the framesthat belonged to the pytest internals.
"filter_traceback" was receiving relative paths when running with
xdist, and full paths in non-distributed runs; for this reason
the traceback function did not consider the received path to be
relative to the pytest internal modules:
pytest/_pytest/python.py
Lines 48 to 49 in 111d640
py.path.local(entry.path)
will create a full path usingcwd
becauseentry.path
is relative, andcwd
would point to thetestdir
directory (as it should).I debugged up until
Code.__init__
:pytest/_pytest/_code/code.py
Lines 19 to 28 in 111d640
And I verified that the
rawcode.co_filename
is indeed a relative path when executed with xdist and a full path in non-distributed, but I don't have a clue as to why.By running the tests in a directory other than where
_pytest
is, thenrawcode.co_filename
is always a full path and everything works.I tried to back trace to other versions (pytest 3.1.0, execnet 1.4 and pytest-xdist 1.19) but the problem still happens in those versions, so I can't figure out why this suddenly started to fail.
I thought I would at least open a PR with my findings and a "workaround" to see if people have any suggestions.
Fix #2843