Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/test_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: MIT

import os
import pathlib
import stat
import sys
Expand Down Expand Up @@ -139,7 +138,7 @@ def bar():
try:
pathlib.Path('pure.py').write_text(new)
pathlib.Path('other.py').touch()
sdist_path = mesonpy.build_sdist(os.fspath(tmp_path))
sdist_path = mesonpy.build_sdist(tmp_path)
finally:
pathlib.Path('pure.py').write_text(old)
pathlib.Path('other.py').unlink()
Expand Down Expand Up @@ -213,12 +212,13 @@ def test_long_path(sdist_long_path):


def test_reproducible(package_pure, tmp_path):
t1 = time.time()
sdist_path_a = mesonpy.build_sdist(tmp_path / 'a')
t2 = time.time()
# Ensure that the two sdists are build at least one second apart.
time.sleep(max(t1 + 1.0 - t2, 0.0))
sdist_path_b = mesonpy.build_sdist(tmp_path / 'b')
with in_git_repo_context():
t1 = time.time()
sdist_path_a = mesonpy.build_sdist(tmp_path / 'a')
t2 = time.time()
# Ensure that the two sdists are build at least one second apart.
time.sleep(max(t1 + 1.0 - t2, 0.0))
sdist_path_b = mesonpy.build_sdist(tmp_path / 'b')

assert sdist_path_a == sdist_path_b
assert tmp_path.joinpath('a', sdist_path_a).read_bytes() == tmp_path.joinpath('b', sdist_path_b).read_bytes()
Loading