Skip to content

Commit

Permalink
MNT: Use the current folder for creating temp dir to avoid caveats of…
Browse files Browse the repository at this point in the history
… using system temp dir. [skip ci]
  • Loading branch information
Taher Chegini committed Nov 8, 2024
1 parent 17ed001 commit 6646622
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions tests/test_async_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,16 @@ def test_text_post():

def test_stream():
url = "https://freetestdata.com/wp-content/uploads/2021/09/Free_Test_Data_500KB_CSV-1.csv"
temp = tempfile.NamedTemporaryFile(delete=False)
temp.close()
ar.stream_write([url], [temp.name])
assert Path(temp.name).stat().st_size == 512789
Path(temp.name).unlink()
with tempfile.NamedTemporaryFile(dir=".") as temp:
ar.stream_write([url], [temp.name])
assert Path(temp.name).stat().st_size == 512789


def test_stream_chunked():
url = "https://freetestdata.com/wp-content/uploads/2021/09/Free_Test_Data_500KB_CSV-1.csv"
temp = tempfile.NamedTemporaryFile(delete=False)
temp.close()
ar.stream_write([url], [temp.name], chunk_size=5000)
assert Path(temp.name).stat().st_size == 512789
Path(temp.name).unlink()
with tempfile.NamedTemporaryFile(dir=".") as temp:
ar.stream_write([url], [temp.name], chunk_size=5000)
assert Path(temp.name).stat().st_size == 512789


def test_ordered_return():
Expand Down

0 comments on commit 6646622

Please sign in to comment.