Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Issues related to OSInfo.bash_path() #3455

Merged
merged 2 commits into from
Sep 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions conans/test/util/tools_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,10 +827,11 @@ def __call__(self, command, output, log_filepath=None,
self._runner = MyRun()

conanfile = MockConanfile()
tools.run_in_windows_bash(conanfile, "a_command.bat", subsystem="cygwin")
self.assertIn("bash", conanfile._runner.command)
self.assertIn("--login -c", conanfile._runner.command)
self.assertIn("^&^& a_command.bat ^", conanfile._runner.command)
with patch.object(OSInfo, "bash_path", return_value='bash'):
tools.run_in_windows_bash(conanfile, "a_command.bat", subsystem="cygwin")
self.assertIn("bash", conanfile._runner.command)
self.assertIn("--login -c", conanfile._runner.command)
self.assertIn("^&^& a_command.bat ^", conanfile._runner.command)

with tools.environment_append({"CONAN_BASH_PATH": "path\\to\\mybash.exe"}):
tools.run_in_windows_bash(conanfile, "a_command.bat", subsystem="cygwin")
Expand All @@ -842,10 +843,11 @@ def __call__(self, command, output, log_filepath=None,

# try to append more env vars
conanfile = MockConanfile()
tools.run_in_windows_bash(conanfile, "a_command.bat", subsystem="cygwin", env={"PATH": "/other/path",
"MYVAR": "34"})
self.assertIn('^&^& PATH=\\^"/cygdrive/other/path:/cygdrive/path/to/somewhere:$PATH\\^" '
'^&^& MYVAR=34 ^&^& a_command.bat ^', conanfile._runner.command)
with patch.object(OSInfo, "bash_path", return_value='bash'):
tools.run_in_windows_bash(conanfile, "a_command.bat", subsystem="cygwin",
env={"PATH": "/other/path", "MYVAR": "34"})
self.assertIn('^&^& PATH=\\^"/cygdrive/other/path:/cygdrive/path/to/somewhere:$PATH\\^" '
'^&^& MYVAR=34 ^&^& a_command.bat ^', conanfile._runner.command)

def download_retries_test(self):
http_server = StoppableThreadBottle()
Expand Down Expand Up @@ -1044,7 +1046,7 @@ def get_values(this_os, this_arch, setting_os, setting_arch, compiler=None):
def detect_windows_subsystem_test(self):
# Dont raise test
result = tools.os_info.detect_windows_subsystem()
if not tools.os_info.bash_path or platform.system() != "Windows":
if not tools.os_info.bash_path() or platform.system() != "Windows":
self.assertEqual(None, result)
else:
self.assertEqual(str, type(result))
Expand Down