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

[Dev] Unit test for tempfile alters test file in place #649

Open
DanielYang59 opened this issue Apr 1, 2024 · 0 comments
Open

[Dev] Unit test for tempfile alters test file in place #649

DanielYang59 opened this issue Apr 1, 2024 · 0 comments

Comments

@DanielYang59
Copy link
Contributor

DanielYang59 commented Apr 1, 2024

Unit test for tempfile (test_tempfile.py) alters test file 3000_lines.txt.gz in place (because of re-gzip), could leadi to repeated commit of this file, for example in fd6b16d.

Triggered by the following test:

def test_with_copy_gzip(self):
# We write a pre-scratch file.
with open("pre_scratch_text", "w") as f:
f.write("write")
init_gz = [f for f in os.listdir(os.getcwd()) if f.endswith(".gz")]
with ScratchDir(
self.scratch_root,
copy_from_current_on_enter=True,
copy_to_current_on_exit=True,
gzip_on_exit=True,
), open("scratch_text", "w") as f:
f.write("write")
files = os.listdir(os.getcwd())
# Make sure the stratch_text.gz exists
assert "scratch_text.gz" in files
for f in files:
if f.endswith(".gz") and f not in init_gz:
os.remove(f)
os.remove("pre_scratch_text")

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

No branches or pull requests

1 participant