File tree Expand file tree Collapse file tree 1 file changed +17
-19
lines changed Expand file tree Collapse file tree 1 file changed +17
-19
lines changed Original file line number Diff line number Diff line change 2626@pytest .fixture (autouse = True , scope = "session" )
2727def setup_buildrunner_test_ssh_key ():
2828 key_file_path = Path (TEST_SSH_KEY_FILE )
29- key_file_path .unlink (missing_ok = True )
30- subprocess .run (
31- [
32- "ssh-keygen" ,
33- "-t" ,
34- "ecdsa" ,
35- "-m" ,
36- "PEM" ,
37- "-N" ,
38- "" ,
39- "-f" ,
40- TEST_SSH_KEY_FILE ,
41- ],
42- check = True ,
43- )
29+ pub_key_file_path = Path (f"{ TEST_SSH_KEY_FILE } .pub" )
30+ if not key_file_path .exists ():
31+ subprocess .run (
32+ [
33+ "ssh-keygen" ,
34+ "-t" ,
35+ "ecdsa" ,
36+ "-m" ,
37+ "PEM" ,
38+ "-N" ,
39+ "" ,
40+ "-f" ,
41+ TEST_SSH_KEY_FILE ,
42+ ],
43+ check = True ,
44+ )
4445 # Set the public key in an environment variable to use in the test buildrunner files
45- os .environ ["BUILDRUNNER_TEST_SSH_PUB_KEY" ] = (
46- Path (f"{ TEST_SSH_KEY_FILE } .pub" ).read_text ().strip ()
47- )
46+ os .environ ["BUILDRUNNER_TEST_SSH_PUB_KEY" ] = pub_key_file_path .read_text ().strip ()
4847 yield
4948 # Cleanup
5049 del os .environ ["BUILDRUNNER_TEST_SSH_PUB_KEY" ]
51- key_file_path .unlink ()
5250
5351
5452def _get_test_args (file_name : str ) -> Optional [List [str ]]:
You can’t perform that action at this time.
0 commit comments