@@ -24,24 +24,27 @@ def test_raxmlng_init_fails_wrong_exe(raxmlng_command):
2424 with pytest .raises (
2525 RuntimeError , match = "Your RAxML-NG executable does not seem to work."
2626 ):
27- with tempfile .NamedTemporaryFile ("wb" ) as tmpfile :
28- # Manually break the RAxML-NG file to trigger the executable-broken error
29- tmpfile .write (b"NonSense" + raxmlng_command .read_bytes ())
30- tmpfile .flush ()
31- RAxMLNG (pathlib .Path (tmpfile .name ))
27+ tmpfile = tempfile .NamedTemporaryFile ("wb" , delete = False )
28+ # Manually break the RAxML-NG file to trigger the executable-broken error
29+ tmpfile .write (b"NonSense" + raxmlng_command .read_bytes ())
30+ tmpfile .close ()
31+ os .chmod (tmpfile .name , 0o777 )
32+ RAxMLNG (pathlib .Path (tmpfile .name ))
33+ os .unlink (tmpfile .name )
3234
3335
3436def test_raxmlng_init_fails_non_raxmlng_exe ():
3537 with pytest .raises (
3638 RuntimeError ,
3739 match = "The given executable `.*` does not seem to be a RAxML-NG executable." ,
3840 ):
39- with tempfile .NamedTemporaryFile ("w" , suffix = ".sh" ) as tmpfile :
40- tmpfile .write ("#!/bin/bash\n " )
41- tmpfile .write ("echo test\n " )
42- tmpfile .flush ()
43- os .chmod (tmpfile .name , 0o777 )
44- RAxMLNG (pathlib .Path (tmpfile .name ))
41+ tmpfile = tempfile .NamedTemporaryFile ("w" , delete = False )
42+ tmpfile .write ("#!/bin/bash\n " )
43+ tmpfile .write ("echo test\n " )
44+ tmpfile .close ()
45+ os .chmod (tmpfile .name , 0o777 )
46+ RAxMLNG (pathlib .Path (tmpfile .name ))
47+ os .unlink (tmpfile .name )
4548
4649
4750def test_get_raxmlng_rfdist_results (raxmlng_rfdistance_log ):
0 commit comments