1212from tiatoolbox .utils .magic import _normalize_binaryio , is_dcm , is_sqlite3 , is_zip
1313
1414
15- def test_is_sqlite3 (tmp_path : Path ) -> None :
15+ def test_is_sqlite3 (track_tmp_path : Path ) -> None :
1616 """Create a dummy sqlite database and use tiatoolbox.magic.is_sqlite3()."""
17- db = sqlite3 .connect (tmp_path / "test.db" )
17+ db = sqlite3 .connect (track_tmp_path / "test.db" )
1818 db .execute ("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT);" )
1919 db .execute ("INSERT INTO test (name) VALUES ('test');" )
2020 db .commit ()
2121 db .close ()
2222
23- (tmp_path / "test.txt" ).write_text ("test" )
23+ (track_tmp_path / "test.txt" ).write_text ("test" )
2424
25- assert is_sqlite3 (tmp_path / "test.db" )
26- assert not is_sqlite3 (tmp_path / "test.txt" )
25+ assert is_sqlite3 (track_tmp_path / "test.db" )
26+ assert not is_sqlite3 (track_tmp_path / "test.txt" )
2727
2828
2929def test_is_dcm (remote_sample : Callable ) -> None :
@@ -33,14 +33,14 @@ def test_is_dcm(remote_sample: Callable) -> None:
3333 assert is_dcm (subpath )
3434
3535
36- def test_is_zip (tmp_path : Path ) -> None :
36+ def test_is_zip (track_tmp_path : Path ) -> None :
3737 """Create a dummy zip file and use tiatoolbox.magic.is_zip()."""
38- (tmp_path / "test.txt" ).write_text ("test" )
39- with zipfile .ZipFile (tmp_path / "test.zip" , "w" ) as zf :
40- zf .write (tmp_path / "test.txt" )
38+ (track_tmp_path / "test.txt" ).write_text ("test" )
39+ with zipfile .ZipFile (track_tmp_path / "test.zip" , "w" ) as zf :
40+ zf .write (track_tmp_path / "test.txt" )
4141
42- assert is_zip (tmp_path / "test.zip" )
43- assert not is_zip (tmp_path / "test.txt" )
42+ assert is_zip (track_tmp_path / "test.zip" )
43+ assert not is_zip (track_tmp_path / "test.txt" )
4444
4545
4646def test_normalize_must_exist () -> None :
@@ -71,24 +71,24 @@ def test_normalize_type_error() -> None:
7171 _normalize_binaryio (1 , must_exist = False )
7272
7373
74- def test_normalize_non_existent (tmp_path : Path ) -> None :
74+ def test_normalize_non_existent (track_tmp_path : Path ) -> None :
7575 """Test that _normalize_binaryio() returns empty BinaryIO for non-existant file."""
7676 assert isinstance (
77- _normalize_binaryio (tmp_path / "foo" , must_exist = False ),
77+ _normalize_binaryio (track_tmp_path / "foo" , must_exist = False ),
7878 (BytesIO , BinaryIO ),
7979 )
8080
8181
82- def test_is_sqlite3_dir (tmp_path : Path ) -> None :
82+ def test_is_sqlite3_dir (track_tmp_path : Path ) -> None :
8383 """Test that is_sqlite3() returns False for directories."""
84- assert not is_sqlite3 (tmp_path )
84+ assert not is_sqlite3 (track_tmp_path )
8585
8686
87- def test_is_dcm_dir (tmp_path : Path ) -> None :
87+ def test_is_dcm_dir (track_tmp_path : Path ) -> None :
8888 """Test that is_dcm() returns False for directories."""
89- assert not is_dcm (tmp_path )
89+ assert not is_dcm (track_tmp_path )
9090
9191
92- def test_is_zip_dir (tmp_path : Path ) -> None :
92+ def test_is_zip_dir (track_tmp_path : Path ) -> None :
9393 """Test that is_zip() returns False for directories."""
94- assert not is_zip (tmp_path )
94+ assert not is_zip (track_tmp_path )
0 commit comments