New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify mbed OS tools testing style with what's used in mbed-ls, htrun, greentea #4984

Merged
merged 10 commits into from Sep 6, 2017

Conversation

Projects
None yet
4 participants
@theotherjimmy
Contributor

theotherjimmy commented Aug 28, 2017

Also enables coverage numbers!

Converts our usage of testing frameworks to use py.test.

Ready

This should only need to be tested by travis CI.

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Aug 29, 2017

@0xc0170 Could you take a look? @adbridge Could you take a look as well?

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Aug 31, 2017

Don't be surprised if this breaks travis CI.

Is this still in devel? I'll have a look tomorrow.

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Aug 31, 2017

Actually, no. It's all working now. I'll update the description.

root_dir = abspath(dirname(__file__))
@pytest.mark.parametrize("name", filter(lambda d: is_test(join(root_dir, d)),
os.listdir(root_dir)))

This comment has been minimized.

@adbridge

adbridge Sep 1, 2017

Contributor

formatting here is a bit weird?

This comment has been minimized.

@theotherjimmy

theotherjimmy Sep 1, 2017

Contributor

Yes it is. I'll have to get on that.

This comment has been minimized.

@theotherjimmy

theotherjimmy Sep 1, 2017

Contributor

This file has been deleted in this branch....

@@ -0,0 +1,12 @@
{
"f": {

This comment has been minimized.

@adbridge

adbridge Sep 1, 2017

Contributor

What are 'f' and 'b2' ? Don't seem very meaningful names ?

@@ -0,0 +1,6 @@
{

This comment has been minimized.

@adbridge

adbridge Sep 1, 2017

Contributor

Spurious space ?

@@ -0,0 +1,6 @@
{

This comment has been minimized.

@adbridge

adbridge Sep 1, 2017

Contributor

spurious space?

expected_results = {
{

This comment has been minimized.

@adbridge

adbridge Sep 1, 2017

Contributor

spurious space

when both are specified
:param mock_json_file_to_dict: mock of function json_file_to_dict
:param _: patch of function _process_config_and_overrides (not tested)

This comment has been minimized.

@adbridge

adbridge Sep 1, 2017

Contributor

missing target param ?

for target in named_targets:
assert target.device_name in cache.index,\
("Target %s contains invalid device_name %s" %
(target.name, target.device_name))

This comment has been minimized.

@adbridge

adbridge Sep 1, 2017

Contributor

alignment

This comment has been minimized.

@theotherjimmy

theotherjimmy Sep 1, 2017

Contributor

That's actually also correct.

@contextmanager
def temp_target_file(extra_target, json_filename='custom_targets.json'):
"""Create an extra targets temp file in a context manager"""

This comment has been minimized.

@adbridge

adbridge Sep 1, 2017

Contributor

parameters ?

"""
Test find_tests for correct use of app_config

This comment has been minimized.

@adbridge

adbridge Sep 1, 2017

Contributor

parameter descriptions?

This comment has been minimized.

@theotherjimmy

theotherjimmy Sep 1, 2017

Contributor

Added.

@pytest.mark.parametrize("app_config", ["app_config", None])
def test_find_tests_app_config(build_path, target, toolchain_name, app_config):
"""
Test find_tests for correct use of app_config

This comment has been minimized.

@adbridge

adbridge Sep 1, 2017

Contributor

parameter descriptions

This comment has been minimized.

@theotherjimmy

theotherjimmy Sep 1, 2017

Contributor

Added.

@0xc0170

0xc0170 approved these changes Sep 4, 2017

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Sep 4, 2017

@adbridge Please rereview

tools/test/memap/memap_test.py Outdated
@@ -191,8 +201,10 @@ def test_generate_output_csv_ci(memap_parser, tmpdir, depth):
"""
Test ensures that an output of type "csv-ci" can be generated correctly
:return:
:param memap_parser: Mocked parser
:param tmpdir: a temporary directory

This comment has been minimized.

@adbridge

adbridge Sep 4, 2017

Contributor

Might be better to say why there is even a temporary directory? Otherwise not that helpful a parameter description.

This comment has been minimized.

@theotherjimmy

theotherjimmy Sep 5, 2017

Contributor

Yes of course.

tools/test/memap/memap_test.py Outdated
@@ -179,8 +186,11 @@ def test_generate_output_table(memap_parser, depth):
def test_generate_output_json(memap_parser, tmpdir, depth):
"""
Test that an output of type "json" can be generated correctly
:param memap_parser: Mocked parser
:param tmpdir: a temporary directory

This comment has been minimized.

@adbridge

adbridge Sep 4, 2017

Contributor

see comment below

@0xc0170 0xc0170 added needs: work and removed needs: review labels Sep 4, 2017

@theotherjimmy theotherjimmy force-pushed the theotherjimmy:unify-unit-tests branch to 4a937fe Sep 5, 2017

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Sep 5, 2017

@adbridge I think I addressed your review comments. Could you take a look?

theotherjimmy added some commits Sep 5, 2017

Clean up json
Wipe out all blank lines in json:
  find tools/test -name 'test_data.json' | xargs sed -i -e '/^$/d'
Move all start braces back a space:
  find tools/test -name 'test_data.json' | xargs sed -i -e "s/^ {/{/"
@coveralls

This comment has been minimized.

coveralls commented Sep 5, 2017

Coverage Status

Changes Unknown when pulling 399b6ac on theotherjimmy:unify-unit-tests into ** on ARMmbed:master**.

@coveralls

This comment has been minimized.

coveralls commented Sep 5, 2017

Coverage Status

Changes Unknown when pulling 9d0e8ab on theotherjimmy:unify-unit-tests into ** on ARMmbed:master**.

@theotherjimmy theotherjimmy force-pushed the theotherjimmy:unify-unit-tests branch Sep 5, 2017

@theotherjimmy theotherjimmy force-pushed the theotherjimmy:unify-unit-tests branch to 6bf7718 Sep 5, 2017

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Sep 6, 2017

Woooooo! We only need to run Travis on this one (it only affects the unit tests) and Travis passed.

@theotherjimmy theotherjimmy merged commit 5bcd97a into ARMmbed:master Sep 6, 2017

3 checks passed

Cam-CI uvisor Build & Test Success
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@theotherjimmy theotherjimmy deleted the theotherjimmy:unify-unit-tests branch Sep 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment