Skip to content

Commit

Permalink
make sure tmp file is random to avoid concurrency issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bisgaard-itis committed Sep 28, 2023
1 parent 6fa21ef commit 2724a70
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clients/python/test/e2e/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import osparc
import pytest
from numpy import random
from pydantic import ByteSize

_KB: ByteSize = ByteSize(1024) # in bytes
Expand All @@ -29,7 +30,9 @@ def cfg() -> osparc.Configuration:
def tmp_file(tmp_path: Path) -> Path:
byte_size: ByteSize = 1 * _GB
tmp_file = tmp_path / "large_test_file.txt"
tmp_file.write_bytes(b"large test file")
ss: random.SeedSequence = random.SeedSequence()
rng: random.Generator = random.default_rng(ss)
tmp_file.write_bytes(rng.bytes(1000))
with open(tmp_file, "wb") as f:
f.truncate(byte_size)
assert (
Expand Down

0 comments on commit 2724a70

Please sign in to comment.