test/py/tests/test_bootstage.py: Combine stash/unstash tests
PATCH 1/1 test/py/tests/test_bootstage.py: Combine stash/unstash tests
When running the bootstage tests currently we get a warning like:
tests/test_bootstage.py::test_bootstage_stash
...PytestReturnNotNoneWarning: Expected None, but tests/test_bootstage.py::test_bootstage_stash returned (37748736, 4096), which will be an error in a future version of pytest. Did you mean to use assert in stead of return?
This is because the unstash test will run the stash test and fetch the addr / size from that. Rework the test to be stash and unstash and then run the unstash command at the end of the current stash test.
---
It's possible we could solve this instead by getting addr / size again from our environment file, and then also noting that order-wise the unstash test follows the stash test. However, this felt more clean to me.
--- test/py/tests/test_bootstage.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
test/py/tests/test_bootstage.py +2 -7
@@ -33,7 +33,7 @@ def test_bootstage_report(u_boot_console): @pytest.mark.buildconfigspec('bootstage') @pytest.mark.buildconfigspec('cmd_bootstage') @pytest.mark.buildconfigspec('bootstage_stash') -def test_bootstage_stash(u_boot_console): +def test_bootstage_stash_and_unstash(u_boot_console): f = u_boot_console.config.env.get('env__bootstage_cmd_file', None) if not f: pytest.skip('No bootstage environment file is defined')
@@ -55,13 +55,8 @@ def test_bootstage_stash(u_boot_console): # Check expected string in last column of output output_last_col = ''.join([i.split()[-1] for i in output.split('\n')]) assert expected_text in output_last_col - return addr, size [email protected]('bootstage') [email protected]('cmd_bootstage') [email protected]('bootstage_stash') -def test_bootstage_unstash(u_boot_console): - addr, size = test_bootstage_stash(u_boot_console) + # Check that unstash works as expected u_boot_console.run_command('bootstage unstash %x %x' % (addr, size)) output = u_boot_console.run_command('echo $?') assert output.endswith('0')
Signature · 1 line
2.34.1
Quoted 8 lines · Tom Rini
When running the bootstage tests currently we get a warning like:
tests/test_bootstage.py::test_bootstage_stash
...PytestReturnNotNoneWarning: Expected None, but tests/test_bootstage.py::test_bootstage_stash returned (37748736, 4096), which will be an error in a future version of pytest. Did you mean to useassertin stead ofreturn?This is because the unstash test will run the stash test and fetch the addr / size from that. Rework the test to be stash and unstash and then run the unstash command at the end of the current stash test.
Quoted 6 lines
Signed-off-by Tom Rini <[email protected]>---
It's possible we could solve this instead by getting addr / size again from our environment file, and then also noting that order-wise the unstash test follows the stash test. However, this felt more clean to me.
It looks good to me.
Thanks,
Michal
Quoted 8 lines · Tom Rini
When running the bootstage tests currently we get a warning like:
tests/test_bootstage.py::test_bootstage_stash
...PytestReturnNotNoneWarning: Expected None, but tests/test_bootstage.py::test_bootstage_stash returned (37748736, 4096), which will be an error in a future version of pytest. Did you mean to useassertin stead ofreturn?This is because the unstash test will run the stash test and fetch the addr / size from that. Rework the test to be stash and unstash and then run the unstash command at the end of the current stash test.
Quoted 6 lines
Signed-off-by Tom Rini <[email protected]>---
It's possible we could solve this instead by getting addr / size again from our environment file, and then also noting that order-wise the unstash test follows the stash test. However, this felt more clean to me.
Agree with this approach.
Regards,
Love Kumar
Quoted 16 lines · Tom Rini
When running the bootstage tests currently we get a warning like:
tests/test_bootstage.py::test_bootstage_stash
...PytestReturnNotNoneWarning: Expected None, but tests/test_bootstage.py::test_bootstage_stash returned (37748736, 4096), which will be an error in a future version of pytest. Did you mean to useassertin stead ofreturn?This is because the unstash test will run the stash test and fetch the addr / size from that. Rework the test to be stash and unstash and then run the unstash command at the end of the current stash test.
Signed-off-by Tom Rini <[email protected]>---
It's possible we could solve this instead by getting addr / size again from our environment file, and then also noting that order-wise the unstash test follows the stash test. However, this felt more clean to me.
Quoted 6 lines
Cc Love Kumar <[email protected]>Cc Michal Simek <[email protected]>Cc Simon Glass <[email protected]>--- test/py/tests/test_bootstage.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
Quoted 32 lines
test/py/tests/test_bootstage.py +2
-8@@ -33,7 +33,7 @@ def test_bootstage_report(u_boot_console): @pytest.mark.buildconfigspec('bootstage') @pytest.mark.buildconfigspec('cmd_bootstage') @pytest.mark.buildconfigspec('bootstage_stash') -def test_bootstage_stash(u_boot_console): +def test_bootstage_stash_and_unstash(u_boot_console): f = u_boot_console.config.env.get('env__bootstage_cmd_file', None) if not f: pytest.skip('No bootstage environment file is defined')@@ -55,13 +55,8 @@ def test_bootstage_stash(u_boot_console): # Check expected string in last column of output output_last_col = ''.join([i.split()[-1] for i in output.split('\n')]) assert expected_text in output_last_col - return addr, size [email protected]('bootstage') [email protected]('cmd_bootstage') [email protected]('bootstage_stash') -def test_bootstage_unstash(u_boot_console): - addr, size = test_bootstage_stash(u_boot_console) + # Check that unstash works as expected u_boot_console.run_command('bootstage unstash %x %x' % (addr, size)) output = u_boot_console.run_command('echo $?') assert output.endswith('0') --2.34.1
Quoted 9 lines · Tom Rini
When running the bootstage tests currently we get a warning like:
tests/test_bootstage.py::test_bootstage_stash
...PytestReturnNotNoneWarning: Expected None, but tests/test_bootstage.py::test_bootstage_stash returned (37748736, 4096), which will be an error in a future version of pytest. Did you mean to useassertin stead ofreturn?This is because the unstash test will run the stash test and fetch the addr / size from that. Rework the test to be stash and unstash and then run the unstash command at the end of the current stash test.
[...]
Applied to u-boot/next, thanks!
Signature · 1 line
Tom