Skip to content

Commit 90b5547

Browse files
add support for appveyor MacOS VMs for testing
This commit adds code to set up `shell_connection`-download tests on appeyor's MacOS workers in such a way that our user-installed `7z` binary is found.
1 parent b0e9cd5 commit 90b5547

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

datalad_next/utils/tests/test_shell_connection.py

+17
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ def test_upload(sshserver, tmp_path):
145145
_check_ls_result(ssh_executor, common_files[0])
146146

147147

148+
def _print_env(ssh_executor: ShellCommandExecutor):
149+
r = ssh_executor.execute_command(b'uname -a')
150+
print(repr(tuple(r)), file=sys.stderr)
151+
r = ssh_executor.execute_command(b'env')
152+
print(repr(tuple(r)), file=sys.stderr)
153+
154+
148155
def test_download(sshserver, tmp_path):
149156
ssh_url, local_path = sshserver
150157
ssh_args, ssh_path = _get_cmdline(ssh_url)
@@ -157,12 +164,17 @@ def test_download(sshserver, tmp_path):
157164
# perform an operation on the remote shell
158165
_check_ls_result(ssh_executor, common_files[0])
159166

167+
# The following allows the appveyor Mac VMs to find `7z`-binaries
168+
r = ssh_executor.execute_command(
169+
b'if [ $(uname) == "Darwin" ]; then export PATH="$PATH":/usr/local/bin; fi')
170+
consume(r)
160171
# download file from server and verify its content
161172
r, stderr = ssh_executor.download(
162173
PurePosixPath(ssh_path + '/' + test_file_name),
163174
download_file)
164175
if r != 0:
165176
print('ssh download stderr output:', repr(stderr), file=sys.stderr)
177+
_print_env(ssh_executor)
166178
assert r == 0
167179
assert download_file.read_text() == content
168180

@@ -179,12 +191,17 @@ def test_end_marker_download(sshserver, tmp_path):
179191
with shell_connection(ssh_args) as ssh_executor:
180192
server_file.write_bytes(ssh_executor.end_marker)
181193

194+
# The following allows the appveyor Mac VMs to find `7z`-binaries
195+
r = ssh_executor.execute_command(
196+
b'if [ $(uname) == "Darwin" ]; then export PATH="$PATH":/usr/local/bin; fi')
197+
consume(r)
182198
# download file from server and verify its content
183199
r, stderr = ssh_executor.download(
184200
PurePosixPath(ssh_path + '/' + test_file_name),
185201
download_file)
186202
if r != 0:
187203
print('ssh download stderr output:', repr(stderr), file=sys.stderr)
204+
_print_env(ssh_executor)
188205
assert r == 0
189206
assert download_file.read_bytes() == ssh_executor.end_marker
190207

0 commit comments

Comments
 (0)