Skip to content

Commit

Permalink
Fix temp data cleanup in test_text.py (#10524)
Browse files Browse the repository at this point in the history
Noticed that when running pytests, cuDF was leaving a temporary file used for a specific test in the testing data folder without removing it. I think  our tests mostly write to `tmp` to avoid this issue.

In switching it to point to `tmp` I noticed the intended data is not being actually written to the file, instead it was writing the string `__repr__` of the generator. I also shrunk the data size by many orders of magnitude, because in the intended case where the data is meant to be truly generated, 30 mil ends up being a little cumbersome and slow.

Authors:
  - https://github.com/brandon-b-miller

Approvers:
  - GALI PREM SAGAR (https://github.com/galipremsagar)

URL: #10524
  • Loading branch information
brandon-b-miller authored Mar 29, 2022
1 parent 19f324c commit 62360cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/cudf/cudf/tests/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,10 +822,10 @@ def test_read_text_byte_range(datadir):
assert_eq(expected, actual)


def test_read_text_byte_range_large(datadir):
content = str(("\n" if x % 5 == 0 else "x") for x in range(0, 300000000))
def test_read_text_byte_range_large(tmpdir):
content = str([["\n" if x % 5 == 0 else "x"] for x in range(0, 3000)])
delimiter = "1."
temp_file = str(datadir) + "/temp.txt"
temp_file = str(tmpdir) + "/temp.txt"

with open(temp_file, "w") as f:
f.write(content)
Expand Down

0 comments on commit 62360cb

Please sign in to comment.