Skip to content

Commit

Permalink
Merge pull request #56 from EliahKagan/no-mktemp
Browse files Browse the repository at this point in the history
Replace use of mktemp
  • Loading branch information
Byron committed Dec 13, 2023
2 parents 7d6f97c + a315725 commit 04dd210
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions smmap/test/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ class FileCreator:
def __init__(self, size, prefix=''):
assert size, "Require size to be larger 0"

self._path = tempfile.mktemp(prefix=prefix)
self._size = size

with open(self._path, "wb") as fp:
fp.seek(size - 1)
fp.write(b'1')
with tempfile.NamedTemporaryFile("wb", prefix=prefix, delete=False) as file:
self._path = file.name
file.seek(size - 1)
file.write(b'1')

assert os.path.getsize(self.path) == size

Expand Down

0 comments on commit 04dd210

Please sign in to comment.