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

Write test for walk_files to check if it accepts Path-like and str objects #3035

Merged
merged 1 commit into from
Jan 7, 2020

Conversation

algomaster99
Copy link
Contributor

@algomaster99 algomaster99 commented Jan 1, 2020

  • ❗ Have you followed the guidelines in the Contributing to DVC list?

  • πŸ“– Check this box if this PR does not require documentation updates, or if it does and you have created a separate PR in dvc.org with such updates (or at least opened an issue about it in that repo). Please link below to your PR (or issue) in the dvc.org repo.

  • ❌ Have you checked DeepSource, CodeClimate, and other sanity checks below? We consider their findings recommendatory and don't expect everything to be addressed. Please review them carefully and fix those that actually improve code or fix bugs.

Thank you for the contribution - we'll try to review it as soon as possible. πŸ™

Reference: #2137

@codecov
Copy link

codecov bot commented Jan 1, 2020

Codecov Report

Merging #3035 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3035      +/-   ##
==========================================
- Coverage   91.84%   91.82%   -0.02%     
==========================================
  Files         138      138              
  Lines        8531     8531              
==========================================
- Hits         7835     7834       -1     
- Misses        696      697       +1
Impacted Files Coverage Ξ”
dvc/updater.py 54.65% <0%> (-1.17%) ⬇️

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 e2efb7b...13ca5bd. Read the comment docs.

Comment on lines 146 to 154
path_list = []
for path in walk_files(repo_dir.root_dir):
path_list.append(path)

path_info_list = []
for path_info in walk_files(PathInfo(repo_dir.root_dir)):
path_info_list.append(path_info)

assert path_list == path_info_list
Copy link
Contributor

Choose a reason for hiding this comment

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

You could simply

def test_walk_files(tmp_dir):
    assert list(walk_files(".")) == list(walk_files(tmp_dir))

tmp_dir is a new fixture we've introduced recently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@efiop how will convert a path into Path-like object then?

Copy link
Contributor

Choose a reason for hiding this comment

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

@algomaster99 tmp_dir is a a path-like object πŸ™‚

@efiop
Copy link
Contributor

efiop commented Jan 6, 2020

@algomaster99 Could you please adjust and rebase?

@algomaster99
Copy link
Contributor Author

@efiop I have made the necessary changes. Really, sorry for the delay. πŸ˜… .

@algomaster99 algomaster99 requested a review from efiop January 7, 2020 00:29
@efiop
Copy link
Contributor

efiop commented Jan 7, 2020

Thanks @algomaster99 ! πŸ™

@efiop efiop merged commit df214fa into master Jan 7, 2020
@delete-merged-branch delete-merged-branch bot deleted the test-walk_files branch January 7, 2020 03:33
@Suor Suor mentioned this pull request Jan 8, 2020
2 tasks
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.

2 participants