PelionIoT / mbed-edge

Edge Core
https://izumanetworks.com
Apache License 2.0
25 stars 32 forks source link

edge-tool update & tests #101

Closed JanneKiiskila closed 1 year ago

JanneKiiskila commented 1 year ago

Mbed Edge pull request

Description

Test instructions

GitHub action should cover, run pytest in edge-tool -folder.

Check list

API change(s)

Example applications updated

JanneKiiskila commented 1 year ago

The provided pytest tests pass for me locally on the Ubuntu 22.04 machine, but not on the remote. The printing is producing a different output for some reason (best guess at this stage).

jannek@jannek-P720:/ssd/mbed-edge/edge-tool$ source test-310/bin/activate
bash: test-310/bin/activate: No such file or directory
jannek@jannek-P720:/ssd/mbed-edge/edge-tool$ cd ..
jannek@jannek-P720:/ssd/mbed-edge$ source test-310/bin/activate
(test-310) jannek@jannek-P720:/ssd/mbed-edge$ cd edge-tool/
(test-310) jannek@jannek-P720:/ssd/mbed-edge/edge-tool$ pytest
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.10.6, pytest-7.1.3, pluggy-0.13.1
rootdir: /ssd/mbed-edge/edge-tool
plugins: stress-1.0.1, metadata-2.0.2, rerunfailures-10.2, html-1.22.0
collected 6 items                                                                                                                                                          

tests/test_cbor.py ..                                                                                                                                                [ 33%]
tests/test_cli.py ....                                                                                                                                               [100%]

============================================================================ 6 passed in 3.04s =============================================================================

It fails in the file comparison.

>       assert filecmp.cmp(tmp_outfile, "test_data/device.cbor.txt", shallow=False)
E       AssertionError: assert False
E        +  where False = <function cmp at 0x7f0599bd9090>('/tmp/pytest-of-ed/pytest-0/test_cbor_print0/out.txt', 'test_data/device.cbor.txt', shallow=False)
E        +    where <function cmp at 0x7f0599bd9090> = filecmp.cmp
JanneKiiskila commented 1 year ago

@petedyerarm - thanks for help again, issues is in the last line - cbor print does it with \r\n (aka CRLF). But, I am guessing depending on your git settings or something - it gets turned into plain /n (aka LF) and then it's not matching anymore. Removed the \r from cbor printing.

JanneKiiskila commented 1 year ago

Rebased, force pushed.