1111import sisl
1212from sisl .io ._zipfile import ZipPath
1313
14- # We will xfail all tests if the python version is <=3.9,
15- # this is because sisl is expected to raise a RuntimeError
16- # explaining that zipfile functionality requires Python 3.10 or newer.
17- _is_old_python = sys .version_info < (3 , 10 )
18- # 3.9 also prints very ugly errors when deleting a zipfile which make
19- # it difficult to read the test output. So we patch the __del__ method.
20- if _is_old_python :
21- zipfile .ZipFile .__del__ = lambda self : None
22-
23-
24- @pytest .mark .xfail (
25- _is_old_python ,
26- reason = "Zip file functionality requires Python 3.10 or newer" ,
27- raises = RuntimeError ,
28- )
14+
2915def test_zipfile_preserved ():
3016 """Test that the zipfile is preserved through the sile framework
3117
@@ -48,11 +34,6 @@ def test_zipfile_preserved():
4834 assert fdf .file .root is f
4935
5036
51- @pytest .mark .xfail (
52- _is_old_python ,
53- reason = "Zip file functionality requires Python 3.10 or newer" ,
54- raises = RuntimeError ,
55- )
5637@pytest .mark .parametrize ("specify_class" , [True , False ])
5738@pytest .mark .parametrize ("external_zip" , [True , False ])
5839def test_zipfile_write_read (external_zip : bool , specify_class : bool ):
@@ -97,11 +78,6 @@ def test_zipfile_write_read(external_zip: bool, specify_class: bool):
9778 assert np .allclose (read_geometry .cell , geometry .cell )
9879
9980
100- @pytest .mark .xfail (
101- _is_old_python ,
102- reason = "Zip file functionality requires Python 3.10 or newer" ,
103- raises = RuntimeError ,
104- )
10581@pytest .mark .parametrize ("external_zip" , [True , False ])
10682@pytest .mark .parametrize ("from_fdf" , [True , False ])
10783def test_zipfile_write_read_binary (external_zip : bool , from_fdf : bool ):
@@ -145,11 +121,6 @@ def test_zipfile_write_read_binary(external_zip: bool, from_fdf: bool):
145121 assert np .allclose (H .tocsr ().toarray (), read_H .tocsr ().toarray ())
146122
147123
148- @pytest .mark .xfail (
149- _is_old_python ,
150- reason = "Zip file functionality requires Python 3.10 or newer" ,
151- raises = RuntimeError ,
152- )
153124@pytest .mark .parametrize ("external_zip" , [True , False ])
154125@pytest .mark .parametrize ("from_fdf" , [True , False ])
155126def test_zipfile_write_read_cdf (external_zip : bool , from_fdf : bool ):
0 commit comments