1313import logging
1414import itertools
1515import tempfile
16+ from pathlib import Path
17+ import shutil
1618
1719def check_docker ():
1820 docker_ps = smoketests .run_cmd ("docker" , "ps" , "--format=json" )
@@ -94,13 +96,10 @@ def main():
9496 try :
9597 os .symlink (update_bin_name , SPACETIME_BIN )
9698 except OSError :
97- import shutil
9899 shutil .copyfile (SPACETIME_BIN .with_name (update_bin_name ), SPACETIME_BIN )
99100
100101 os .environ ["SPACETIME_SKIP_CLIPPY" ] = "1"
101102
102- build_template_target ()
103-
104103 if args .docker :
105104 # have docker logs print concurrently with the test output
106105 if args .compose_file :
@@ -113,9 +112,9 @@ def main():
113112 subprocess .Popen (["docker" , "logs" , "-f" , docker_container ])
114113 smoketests .HAVE_DOCKER = True
115114
116- with tempfile .NamedTemporaryFile (mode = "w+b" , suffix = ".toml" , buffering = 0 ) as config_file :
117- config_file . write ( BASE_STDB_CONFIG_PATH .read_bytes ())
118- config_file . flush ( )
115+ with tempfile .NamedTemporaryFile (mode = "w+b" , suffix = ".toml" , buffering = 0 , delete_on_close = False ) as config_file :
116+ with BASE_STDB_CONFIG_PATH .open ( "rb" ) as src , config_file . file as dst :
117+ shutil . copyfileobj ( src , dst )
119118
120119 if args .remote_server is not None :
121120 smoketests .spacetime ("--config-path" , config_file .name , "server" , "edit" , "localhost" , "--url" , args .remote_server , "--yes" )
@@ -128,8 +127,9 @@ def main():
128127 else :
129128 smoketests .new_identity (config_file .name )
130129
131- config_file .seek (0 )
132- smoketests .STDB_CONFIG = config_file .read ().decode ()
130+ smoketests .STDB_CONFIG = Path (config_file .name ).read_text ()
131+
132+ build_template_target ()
133133
134134 if not args .skip_dotnet :
135135 smoketests .HAVE_DOTNET = check_dotnet ()
0 commit comments