nokia / moler

Moler – library to help build automated tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unix_ls_on_device.py not run as expected

bullsbb opened this issue · comments

I can't get expected output from running example script "unix_ls_on_device.py". I confirm that host (1.2.3.4) DOES have file named 'readme.txt' under the home directory of logon user 'test'.

I added one line "print("Remote files are: {}".format(remote_files))" as below:

=================================================================
remote_files = ls_cmd()

print("Remote files are: {}".format(remote_files))

if 'readme.txt' in remote_files['files']:
print("readme.txt file:")
readme_file_info = remote_files['files']['readme.txt']
for attr in readme_file_info:
print(" {:<18}: {}".format(attr, readme_file_info[attr]))

=================================================================

Here are the generated output (I disabled debug trace).

[demo@VM_0_12_centos command]$ python unix_ls_on_device.py
/home/demo/.local/lib/python2.7/site-packages/dateutil/parser/_parser.py:1218: UnknownTimezoneWarning: tzname CEST identified but not understood. Pass tzinfos argument in order to correctly return a timezone-aware datetime. In a future version, this will raise an exception.
category=UnknownTimezoneWarning)
Remote files are: {'files': {u'login:': {'name': u'login:'}, u'Last': {'name': u'Last'}, u'16': {'name': u'16'}, u'-l': {'name': u'-l'}, u'Thu': {'name': u'Thu'}, u'17:21:59': {'name': u'17:21:59'}, u'1.2.3.4': {'name': u'1.2.3.4'}, u'Jul': {'name': u'Jul'}, u']$': {'name': u']$'}, u'2020': {'name': u'2020'}, u'ls': {'name': u'ls'}, u'from': {'name': u'from'}, u'[test@VM-0-8-centos': {'name': u'[test@VM-0-8-centos'}}}

Hi.

Could you please execute ls *.log in the same directory where python unix_ls_on_device.py and attach all log files?

Thanks for your response. After carefully reviewed the changes I made on unix_ls_on_device.py, I found that I forgot to modify expected_prompt to adapt to the remote server.

After modification, the result was as expected.

OK. Then I close.