Skip to content

Commit f276cd6

Browse files
committed
use tmp_path fixture
1 parent 8ee6aa2 commit f276cd6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

cuda_bindings/tests/test_nvjitlink.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# is strictly prohibited.
88

99
import pytest
10-
import os
10+
1111
from cuda.bindings import nvjitlink
1212

1313

@@ -76,16 +76,13 @@ def test_add_data():
7676
nvjitlink.destroy(handle)
7777

7878

79-
def test_add_file():
79+
def test_add_file(tmp_path):
8080
handle = nvjitlink.create(1, ["-arch=sm_90"])
81-
file_path = "test_file.cubin"
82-
with open (file_path, "wb") as f:
83-
f.write(ptx_kernel_bytes)
84-
81+
file_path = tmp_path / "test_file.cubin"
82+
file_path.write_bytes(ptx_kernel_bytes)
8583
nvjitlink.add_file(handle, nvjitlink.InputType.ANY, str(file_path))
8684
nvjitlink.complete(handle)
8785
nvjitlink.destroy(handle)
88-
os.remove(file_path)
8986

9087

9188
def test_get_error_log():

0 commit comments

Comments
 (0)