def FindExecutable_RelativePath_test(): with TemporaryExecutable() as executable: dirname, exename = os.path.split(executable) relative_executable = os.path.join('.', exename) with CurrentWorkingDirectory(dirname): assert_that(relative_executable, equal_to(utils.FindExecutable(relative_executable)))
def FindExecutable_AdditionalPathExt_test(): with TemporaryExecutable(extension='.xyz') as executable: eq_(executable, utils.FindExecutable(executable))
def FindExecutable_CurrentDirectory_test(): with TemporaryExecutable() as executable: dirname, exename = os.path.split(executable) with CurrentWorkingDirectory(dirname): eq_(executable, utils.FindExecutable(exename))
def FindExecutable_ExecutableNameInPath_test(): with TemporaryExecutable() as executable: dirname, exename = os.path.split(executable) eq_(executable, utils.FindExecutable(exename))
def FindExecutable_AbsolutePath_test(): with TemporaryExecutable() as executable: eq_(executable, utils.FindExecutable(executable))
def test_FindExecutableWithFallback_UserProvided(self): with TemporaryExecutable() as executable: with TemporaryExecutable() as fallback: assert_that( utils.FindExecutableWithFallback(executable, fallback), equal_to(executable))
def test_FindExecutableWithFallback_Empty(self): with TemporaryExecutable() as fallback: assert_that(utils.FindExecutableWithFallback('', fallback), equal_to(fallback))
def test_FindExecutable_AdditionalPathExt(self): with TemporaryExecutable(extension='.xyz') as executable: assert_that(executable, equal_to(utils.FindExecutable(executable)))
def test_FindExecutable_CurrentDirectory(self): with TemporaryExecutable() as executable: dirname, exename = os.path.split(executable) with CurrentWorkingDirectory(dirname): assert_that(executable, equal_to(utils.FindExecutable(exename)))
def test_FindExecutable_ExecutableNameInPath(self): with TemporaryExecutable() as executable: dirname, exename = os.path.split(executable) assert_that(executable, equal_to(utils.FindExecutable(exename)))
def test_FindExecutable_AbsolutePath(self): with TemporaryExecutable() as executable: assert_that(executable, equal_to(utils.FindExecutable(executable)))
def FindExecutableWithFallback_UserProvided_Invalid_test(find_executable): with TemporaryExecutable() as executable: with TemporaryExecutable() as fallback: assert_that(utils.FindExecutableWithFallback(executable, fallback), equal_to(None))