Skip to content

Fix/improve handling of chdir with no-args and testpaths #4336

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 1 commit into from
Nov 8, 2018

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Nov 7, 2018

Fixes #4332.

@blueyed
Copy link
Contributor Author

blueyed commented Nov 7, 2018

As per https://github.com/pytest-dev/pytest/pull/4317/files#r231699560 there could also be a warning, but that would add an extra os.getcwd() (not too bad though), but I am not really sure how helpful this would be after all.

@codecov
Copy link

codecov bot commented Nov 8, 2018

Codecov Report

Merging #4336 into features will decrease coverage by 0.19%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           features    #4336     +/-   ##
===========================================
- Coverage     95.84%   95.64%   -0.2%     
===========================================
  Files           111      111             
  Lines         24893    24900      +7     
  Branches       2431     2428      -3     
===========================================
- Hits          23858    23816     -42     
- Misses          737      781     +44     
- Partials        298      303      +5
Flag Coverage Δ
#docs 28.9% <0%> (-0.04%) ⬇️
#doctesting 28.9% <0%> (-0.04%) ⬇️
#linting 28.9% <0%> (-0.04%) ⬇️
#linux 95.43% <100%> (-0.2%) ⬇️
#nobyte ?
#numpy 41.66% <20%> (-51.36%) ⬇️
#pexpect 41.66% <20%> (-0.03%) ⬇️
#py27 93.8% <100%> (-0.22%) ⬇️
#py34 92.15% <100%> (ø) ⬆️
#py35 92.16% <100%> (ø) ⬆️
#py36 93.71% <100%> (-0.2%) ⬇️
#py37 92.21% <100%> (ø) ⬆️
#trial 41.66% <20%> (-51.36%) ⬇️
#windows 93.25% <100%> (-0.72%) ⬇️
#xdist ?
Impacted Files Coverage Δ
src/_pytest/config/__init__.py 94.66% <100%> (-0.34%) ⬇️
testing/test_collection.py 99.78% <100%> (ø) ⬆️
src/_pytest/reports.py 86.9% <0%> (-10.72%) ⬇️
testing/test_terminal.py 97.46% <0%> (-2.54%) ⬇️
testing/test_junitxml.py 96.15% <0%> (-1.75%) ⬇️
src/_pytest/terminal.py 91.49% <0%> (-1.54%) ⬇️
testing/test_parseopt.py 93.87% <0%> (-0.82%) ⬇️
testing/deprecated_test.py 99.26% <0%> (-0.74%) ⬇️
testing/acceptance_test.py 97.84% <0%> (-0.44%) ⬇️
... and 8 more

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 5dd509c...3137c89. Read the comment docs.

args = self.getini("testpaths")
if self.invocation_dir == self.rootdir:
args = [
str(self.invocation_dir.join(x)) if not os.path.isabs(x) else x
Copy link
Member

Choose a reason for hiding this comment

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

you can use self.invocation_dir.join(x, abs=True) and i believe the cast to str is not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The cast to string was needed for xdist.

Copy link
Member

Choose a reason for hiding this comment

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

good point, then it is definitively needed for the line below where it sets args = [self.invocation_dir]

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

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

👍

@blueyed blueyed merged commit 6c06057 into pytest-dev:features Nov 8, 2018
@blueyed blueyed deleted the cwd2 branch November 8, 2018 23:38
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