Skip to content
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

More utils tests #113

Merged
merged 5 commits into from
Jan 8, 2018
Merged

More utils tests #113

merged 5 commits into from
Jan 8, 2018

Conversation

allenh1
Copy link
Contributor

@allenh1 allenh1 commented Jan 4, 2018

Mark certain functions with # pragma: no cover so that they don't get counted in the coverage results, as well as add a bit more to the license tests.

allenh1@hunter-laptop ~/work/superflore $ coverage run --source=superflore -m "nose" && coverage report -m
..............................
----------------------------------------------------------------------
Ran 30 tests in 1.879s

OK
Name                                               Stmts   Miss  Cover   Missing
--------------------------------------------------------------------------------
superflore/CacheManager.py                            20     13    35%   23-24, 28-33, 37-41
superflore/TempfileManager.py                         34     23    32%   27-28, 31-41, 44-57
superflore/__init__.py                                10      4    60%   5-8
superflore/docker.py                                  32     12    62%   40, 43-59
superflore/exceptions.py                              12      3    75%   18, 28, 33
superflore/generate_installers.py                     57     48    16%   32-86
superflore/generators/__init__.py                      0      0   100%
superflore/generators/bitbake/__init__.py              3      1    67%   3
superflore/generators/bitbake/gen_packages.py        115     92    20%   40-103, 110-166, 174-182, 188
superflore/generators/bitbake/ros_meta.py             27     18    33%   24-27, 30-35, 38-51, 54-55
superflore/generators/bitbake/run.py                 113     94    17%   39-44, 51-199
superflore/generators/bitbake/yocto_recipe.py        112     92    18%   43-64, 67, 70-74, 77-89, 92-96, 99-101, 104-105, 113-116, 125-177
superflore/generators/ebuild/__init__.py               3      1    67%   3
superflore/generators/ebuild/ebuild.py               135      7    95%   125-127, 131-136
superflore/generators/ebuild/gen_packages.py         151    125    17%   45-113, 118-150, 155-211, 216-233, 236, 239
superflore/generators/ebuild/metadata_xml.py          33      0   100%
superflore/generators/ebuild/overlay_instance.py      37     25    32%   27-32, 35-45, 48-64, 67-68
superflore/generators/ebuild/run.py                  157    137    13%   40-43, 47-52, 59-250
superflore/repo_instance.py                           49     34    31%   26-35, 38-46, 49-57, 63, 69, 75, 81, 84-91
superflore/rosdep_support.py                          34      2    94%   83-84
superflore/utils.py                                  109     40    63%   54-59, 108, 114, 121-124, 126, 132, 138-139, 144, 148-149, 156-177
--------------------------------------------------------------------------------
TOTAL                                               1243    771    38%

tfoote
tfoote previously requested changes Jan 8, 2018
Copy link
Member

@tfoote tfoote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No covering the IO is fine, but the others I think could easily have tests written for them.

@@ -59,7 +59,7 @@ def get_pkg_version(distro, pkg_name):
return maj_min_patch


def rand_ascii_str(length=10):
def rand_ascii_str(length=10): # pragma: no cover
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one you could test returns only ascii characters and that the length is as expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a good point. Thanks.

print(colored('>>>> {0}'.format(string), 'cyan'))


def make_dir(dirname):
def make_dir(dirname): # pragma: no cover
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be trivially tested in a tempdir. It would be good to add tests for the different edge cases such as the directory existing, not existing, is file, and not writable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. Will do.

@allenh1
Copy link
Contributor Author

allenh1 commented Jan 8, 2018

Latest report below. Getting better! I'd say the next priority is generate_installers.py. @tfoote what do you think?

allenh1@hunter-laptop ~/work/superflore $ coverage run --source=superflore -m "nose" && coverage report -m
................................
----------------------------------------------------------------------
Ran 32 tests in 5.886s

OK
Name                                               Stmts   Miss  Cover   Missing
--------------------------------------------------------------------------------
superflore/CacheManager.py                            20     13    35%   23-24, 28-33, 37-41
superflore/TempfileManager.py                         34     12    65%   32-37, 48-56
superflore/__init__.py                                10      4    60%   5-8
superflore/docker.py                                  32     12    62%   40, 43-59
superflore/exceptions.py                              12      3    75%   18, 28, 33
superflore/generate_installers.py                     57     48    16%   32-86
superflore/generators/__init__.py                      0      0   100%
superflore/generators/bitbake/__init__.py              3      1    67%   3
superflore/generators/bitbake/gen_packages.py        115     92    20%   40-103, 110-166, 174-182, 188
superflore/generators/bitbake/ros_meta.py             27     18    33%   24-27, 30-35, 38-51, 54-55
superflore/generators/bitbake/run.py                 113     94    17%   39-44, 51-199
superflore/generators/bitbake/yocto_recipe.py        112     92    18%   43-64, 67, 70-74, 77-89, 92-96, 99-101, 104-105, 113-116, 125-177
superflore/generators/ebuild/__init__.py               3      1    67%   3
superflore/generators/ebuild/ebuild.py               143      7    95%   125-127, 131-136
superflore/generators/ebuild/gen_packages.py         151    125    17%   45-113, 118-150, 155-211, 216-233, 236, 239
superflore/generators/ebuild/metadata_xml.py          33      0   100%
superflore/generators/ebuild/overlay_instance.py      37     25    32%   27-32, 35-45, 48-64, 67-68
superflore/generators/ebuild/run.py                  157    137    13%   40-43, 47-52, 59-250
superflore/repo_instance.py                           49     34    31%   26-35, 38-46, 49-57, 63, 69, 75, 81, 84-91
superflore/rosdep_support.py                          34      2    94%   83-84
superflore/utils.py                                  118     41    65%   50, 54-59, 108, 114, 121-124, 126, 132, 138-139, 144, 148-149, 156-177
--------------------------------------------------------------------------------
TOTAL                                               1260    761    40%

Copy link
Member

@tfoote tfoote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the extra tests.

@allenh1 allenh1 merged commit f836f17 into master Jan 8, 2018
@allenh1 allenh1 deleted the more-utils-tests branch January 8, 2018 19:23
zffgithub pushed a commit to zffgithub/superflore that referenced this pull request Apr 11, 2023
* Skip print functions during coverage check.

* Add more license tests.

* Add test for make_dir.

* Add test for random ascii strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants