88import os
99import ctypes
1010import pytest
11- import sys
12- from unittest .mock import Mock , MagicMock , patch , call
11+ from unittest .mock import MagicMock , patch
1312
1413# Mock the library loading before importing the cufile module
1514mock_libcufile = MagicMock ()
2322
2423with patch ("ctypes.CDLL" , return_value = mock_libcufile ):
2524 from cufile import CuFile , CuFileDriver
26- from cufile .bindings import CUfileError , CUfileHandle_t , CUfileDescr , DescrUnion
25+ from cufile .bindings import CUfileError , CUfileHandle_t
2726
2827# this is needed to avoid exceptions while the singleton driver object is
2928# GCed at the program exit.
@@ -62,7 +61,6 @@ def reset_singleton():
6261 """Reset the CuFileDriver singleton between tests."""
6362 # The singleton decorator stores instances in a closure
6463 # We need to access and clear it
65- import cufile .cufile as cufile_module
6664
6765 # Force garbage collection to clean up any lingering instances
6866 import gc
@@ -80,7 +78,7 @@ class TestCuFileDriver:
8078
8179 def test_driver_initialization (self , mock_libcufile ):
8280 """Test that CuFileDriver calls cuFileDriverOpen on initialization."""
83- driver = CuFileDriver ()
81+ CuFileDriver ()
8482 mock_libcufile .cuFileDriverOpen .assert_called_once ()
8583
8684 def test_driver_singleton_pattern (self , mock_libcufile ):
@@ -244,7 +242,7 @@ def test_context_manager_closes_on_exception(
244242 ):
245243 """Test that context manager closes file even on exception."""
246244 try :
247- with CuFile ("/tmp/test.bin" , "r" ) as cufile :
245+ with CuFile ("/tmp/test.bin" , "r" ):
248246 raise ValueError ("Test exception" )
249247 except ValueError :
250248 pass
0 commit comments