Files
rpi-buildroot/support/testing/tests/package/sample_python_scp.py
Julien Olivain 33947d6b5a support/testing: python-scp: fix test sample script
When the test was introduced in [1], a comparison of the source and
the destination file was added, with a typo (the method ".cmp" name is
missing).

The test is failing with error such as in [2]:

    Traceback (most recent call last):
      File "/root/sample_python_scp.py", line 15, in <module>
        assert filecmp("/etc/hostname", "/tmp/hostname")
               ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: 'module' object is not callable

This commit fixes that.

[1] 7470587cfa
[2] https://gitlab.com/buildroot.org/buildroot/-/jobs/11781378510

Cc: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-10-21 18:57:16 +02:00

16 lines
434 B
Python

import filecmp
from paramiko import SSHClient
from paramiko.client import AutoAddPolicy
from scp import SCPClient
ssh_client = SSHClient()
ssh_client.load_system_host_keys()
ssh_client.set_missing_host_key_policy(AutoAddPolicy)
ssh_client.connect('127.0.0.1', username='root')
scp_client = SCPClient(ssh_client.get_transport())
scp_client.get("/etc/hostname", "/tmp/hostname")
assert filecmp.cmp("/etc/hostname", "/tmp/hostname")