@@ -575,7 +575,7 @@ def _get_expected_config(self):
575575 return configs
576576
577577 def get_expected_config (self , expected_preconfig , expected ,
578- env , api , modify_path_cb = None ):
578+ env , api , modify_path_cb = None , cwd = None ):
579579 configs = self ._get_expected_config ()
580580
581581 pre_config = configs ['pre_config' ]
@@ -618,6 +618,14 @@ def get_expected_config(self, expected_preconfig, expected,
618618 expected ['base_executable' ] = default_executable
619619 if expected ['program_name' ] is self .GET_DEFAULT_CONFIG :
620620 expected ['program_name' ] = './_testembed'
621+ if MS_WINDOWS :
622+ # follow the calculation in getpath.py
623+ tmpname = expected ['program_name' ] + '.exe'
624+ if cwd :
625+ tmpname = os .path .join (cwd , tmpname )
626+ if os .path .isfile (tmpname ):
627+ expected ['program_name' ] += '.exe'
628+ del tmpname
621629
622630 config = configs ['config' ]
623631 for key , value in expected .items ():
@@ -711,7 +719,7 @@ def check_all_configs(self, testname, expected_config=None,
711719 self .get_expected_config (expected_preconfig ,
712720 expected_config ,
713721 env ,
714- api , modify_path_cb )
722+ api , modify_path_cb , cwd )
715723
716724 out , err = self .run_embedded_interpreter (testname ,
717725 env = env , cwd = cwd )
0 commit comments