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

Do not overwrite identical files #1576

Merged
merged 5 commits into from
Apr 21, 2024

Conversation

kefirbandi
Copy link
Contributor

If _render_allowed identifies identical source and target, then only returns True if the path refers to a directory, not a file.

If _render_allowed identifies identical source and target, then only returns True if the path refers to a directory, not a file.
Copy link

codecov bot commented Apr 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.33%. Comparing base (70aa69f) to head (f7d261e).
Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1576      +/-   ##
==========================================
+ Coverage   97.29%   97.33%   +0.04%     
==========================================
  Files          48       48              
  Lines        4621     4728     +107     
==========================================
+ Hits         4496     4602     +106     
- Misses        125      126       +1     
Flag Coverage Δ
unittests 97.33% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sisp
Copy link
Member

sisp commented Apr 7, 2024

Just a test is missing (see #1092 (reply in thread)).

Resolves #1092.

@yajo
Copy link
Member

yajo commented Apr 7, 2024

Cool! Do you know how to add the test then?

@kefirbandi
Copy link
Contributor Author

Cool! Do you know how to add the test then?

I would use the testcase: test_skip_if_exists as an example, and write something along the lines of:

def test_timestamp_identical(tmp_path: Path) -> None:
    copier.run_copy(str(Path("tests", "demo_skip_dst")), tmp_path)
    modification_time_before = ...
    sleep(2)
    copier.run_copy(str(Path("tests", "demo_skip_dst")), tmp_path)
    modification_time_after = ...

    assert modification_time_before == modification_time_after
   

Does it make sense?

@yajo
Copy link
Member

yajo commented Apr 8, 2024 via email

test whether identical files are not overwritten, by checking modification timestamp
added missing dependency (sleep)
Copy link
Member

@sisp sisp left a comment

Choose a reason for hiding this comment

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

Just a minor linter error. LGTM otherwise! 🎉

tests/test_copy.py Outdated Show resolved Hide resolved
Import order
@yajo yajo enabled auto-merge (squash) April 20, 2024 04:42
tests/test_copy.py Outdated Show resolved Hide resolved
auto-merge was automatically disabled April 21, 2024 08:41

Head branch was pushed to by a user without write access

@kefirbandi kefirbandi requested a review from sisp April 21, 2024 08:45
@sisp sisp merged commit 10fbbcc into copier-org:master Apr 21, 2024
21 checks passed
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