summaryrefslogtreecommitdiff
path: root/tests/test_wheelfile.py
diff options
context:
space:
mode:
authorHenry Schreiner <HenrySchreinerIII@gmail.com>2023-03-11 03:10:54 -0800
committerGitHub <noreply@github.com>2023-03-11 13:10:54 +0200
commitfb33195c690e0a0d489c5392d83efa4c4c23838a (patch)
tree27bd50594a4eb52ea5dee29cd7222141679ae7c1 /tests/test_wheelfile.py
parent0de0c1af8e3bd8cbc813cb79ee6c7f1765088949 (diff)
downloadwheel-git-fb33195c690e0a0d489c5392d83efa4c4c23838a.tar.gz
Used modern tmp_path instead of py.path based tmpdir (#513)
Diffstat (limited to 'tests/test_wheelfile.py')
-rw-r--r--tests/test_wheelfile.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/test_wheelfile.py b/tests/test_wheelfile.py
index ce134f9..ab286a6 100644
--- a/tests/test_wheelfile.py
+++ b/tests/test_wheelfile.py
@@ -10,8 +10,8 @@ from wheel.wheelfile import WheelFile
@pytest.fixture
-def wheel_path(tmpdir):
- return str(tmpdir.join("test-1.0-py2.py3-none-any.whl"))
+def wheel_path(tmp_path):
+ return str(tmp_path.joinpath("test-1.0-py2.py3-none-any.whl"))
@pytest.mark.parametrize(
@@ -21,9 +21,9 @@ def wheel_path(tmpdir):
"foo-2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
],
)
-def test_wheelfile_re(filename, tmpdir):
+def test_wheelfile_re(filename, tmp_path):
# Regression test for #208 and #485
- path = tmpdir.join(filename)
+ path = tmp_path.joinpath(filename)
with WheelFile(str(path), "w") as wf:
assert wf.parsed_filename.group("namever") == "foo-2"
@@ -147,12 +147,12 @@ def test_write_str(wheel_path):
)
-def test_timestamp(tmpdir_factory, wheel_path, monkeypatch):
+def test_timestamp(tmp_path_factory, wheel_path, monkeypatch):
# An environment variable can be used to influence the timestamp on
# TarInfo objects inside the zip. See issue #143.
- build_dir = tmpdir_factory.mktemp("build")
+ build_dir = tmp_path_factory.mktemp("build")
for filename in ("one", "two", "three"):
- build_dir.join(filename).write(filename + "\n")
+ build_dir.joinpath(filename).write_text(filename + "\n", encoding="utf-8")
# The earliest date representable in TarInfos, 1980-01-01
monkeypatch.setenv("SOURCE_DATE_EPOCH", "315576060")
@@ -169,14 +169,14 @@ def test_timestamp(tmpdir_factory, wheel_path, monkeypatch):
@pytest.mark.skipif(
sys.platform == "win32", reason="Windows does not support UNIX-like permissions"
)
-def test_attributes(tmpdir_factory, wheel_path):
+def test_attributes(tmp_path_factory, wheel_path):
# With the change from ZipFile.write() to .writestr(), we need to manually
# set member attributes.
- build_dir = tmpdir_factory.mktemp("build")
+ build_dir = tmp_path_factory.mktemp("build")
files = (("foo", 0o644), ("bar", 0o755))
for filename, mode in files:
- path = build_dir.join(filename)
- path.write(filename + "\n")
+ path = build_dir.joinpath(filename)
+ path.write_text(filename + "\n", encoding="utf-8")
path.chmod(mode)
with WheelFile(wheel_path, "w") as wf: