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

Handle os.chdir() during collection #4317

Merged
merged 1 commit into from
Nov 7, 2018
Merged

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Nov 5, 2018

No description provided.

@codecov
Copy link

codecov bot commented Nov 6, 2018

Codecov Report

Merging #4317 into features will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##           features    #4317      +/-   ##
============================================
+ Coverage     95.84%   95.84%   +<.01%     
============================================
  Files           111      111              
  Lines         24888    24895       +7     
  Branches       2427     2427              
============================================
+ Hits          23854    23861       +7     
  Misses          737      737              
  Partials        297      297
Flag Coverage Δ
#docs 28.91% <10%> (-0.01%) ⬇️
#doctesting 28.91% <10%> (-0.01%) ⬇️
#linting 28.91% <10%> (-0.01%) ⬇️
#linux 95.63% <100%> (ø) ⬆️
#nobyte 91.82% <100%> (ø) ⬆️
#numpy 93% <100%> (ø) ⬆️
#pexpect 41.67% <20%> (-0.02%) ⬇️
#py27 94% <100%> (+0.02%) ⬆️
#py34 92.15% <100%> (+0.06%) ⬆️
#py35 92.16% <100%> (+0.06%) ⬆️
#py36 93.91% <100%> (ø) ⬆️
#py37 92.21% <100%> (+0.06%) ⬆️
#trial 93% <100%> (ø) ⬆️
#windows 93.97% <100%> (ø) ⬆️
#xdist 93.73% <100%> (ø) ⬆️
Impacted Files Coverage Δ
src/_pytest/config/__init__.py 95% <100%> (ø) ⬆️
testing/test_collection.py 99.78% <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 1752c7e...cb57159. Read the comment docs.

@blueyed blueyed changed the title [WIP/RFC] Handle os.chdir() during collection [RFC] Handle os.chdir() during collection Nov 6, 2018
@blueyed blueyed changed the title [RFC] Handle os.chdir() during collection Handle os.chdir() during collection Nov 7, 2018
@blueyed blueyed added type: enhancement new feature or API change, should be merged into features branch topic: collection related to the collection phase labels Nov 7, 2018
@blueyed blueyed merged commit 4c00552 into pytest-dev:features Nov 7, 2018
@blueyed blueyed deleted the cwd branch November 7, 2018 21:49
@@ -847,11 +848,10 @@ def parse(self, args, addopts=True):
args, self.option, namespace=self.option
)
if not args:
cwd = os.getcwd()
if cwd == self.rootdir:
if self.cwd == self.rootdir:
Copy link
Member

Choose a reason for hiding this comment

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

i just noticed this one - its "incorrect"

if test-paths is relative to the original cwd, then the result is entirely incorrect

its absolutely necessary to trigger a warning there - fundamentally a testsuite that changes the cwd at import time for bits of the suite already is broken and users should rectify that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RonnyPfannschmidt
Ah.. so this should make testpaths absolute then probably.

I agree that os.chdir during import etc is bad, but it seemed easy enough to work around / fix this.
Will create a follow-up.

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: enhancement new feature or API change, should be merged into features branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants