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

Increase test coverage (90%) #368

Merged
merged 3 commits into from
Apr 25, 2023
Merged

Conversation

aelsayed95
Copy link
Contributor

@aelsayed95 aelsayed95 commented Apr 24, 2023

For #351

Describe your changes

  • Adds integration tests for tree, stats and summary commands
  • Adds unit tests for the stats command
  • Raises minimum required coverage to --cov-fail-under=90

Testing performed
Ran tests and make pycoverage: the above commands are now at 100% coverage (but not the related reporters).

Total coverage: 93%
---------- coverage: platform linux, python 3.10.11-final-0 ----------
Name                                                 Stmts   Miss Branch BrPart  Cover   Missing
------------------------------------------------------------------------------------------------
src/memray/__main__.py                                   4      0      2      1    83%   5->exit
src/memray/_ipython/flamegraph.py                       65      3     14      3    92%   102, 131, 138
src/memray/commands/attach.py                          160     69     64     12    50%   97->103, 101, 106-108, 119->123, 128-156, 161-163, 178-185, 188-190, 205-206, 209-219, 301-306, 311, 325-326, 343, 353, 367-383
src/memray/commands/common.py                           93      9     26      5    88%   14, 36, 47, 53, 63, 130->133, 134-143
src/memray/commands/live.py                             43      8     22      5    74%   91, 96->100, 110, 112, 115-119
src/memray/commands/run.py                             155     15     62      9    88%   46, 82-93, 98->100, 101, 122-124, 127-129, 137, 139->142, 181, 307, 314, 317
src/memray/commands/transform.py                        39      3     12      5    84%   37, 46->exit, 53, 55, 64->72
src/memray/reporters/flamegraph.py                     123      7     36      8    89%   110-113, 120->122, 122->125, 159->161, 161->164, 170, 189->192, 205, 232
src/memray/reporters/stats.py                           95      2     41      2    97%   89, 135
src/memray/reporters/table.py                           33      1      6      1    95%   67
src/memray/reporters/transform.py                       52      1     14      1    97%   82
src/memray/reporters/tui.py                            235      2     62      1    99%   58, 374
tests/integration/misbehaving_extension/setup.py        10     10      2      0     0%   1-12
tests/integration/multithreaded_extension/main.py        8      8      2      0     0%   1-13
tests/integration/multithreaded_extension/setup.py      10     10      2      0     0%   1-12
tests/integration/test_api.py                           54      4     30      4    90%   73, 86, 93, 105
tests/integration/test_attach.py                        36      6     10      2    78%   58, 90-96, 100->exit
tests/integration/test_extensions.py                   169      3     46      0    99%   81-83
tests/integration/test_main.py                         450     36     38      7    91%   85-86, 94-103, 537->543, 1132-1137, 1251-1254, 1258-1261, 1268->exit, 1293-1296, 1306->exit, 1328-1329, 1356-1358, 1366->exit, 1390-1392, 1473
tests/integration/test_native_tracking.py              263      4    100      2    98%   247->254, 300-303
tests/integration/test_processes.py                     99     70     38      0    21%   27-30, 34-36, 42-74, 80-130, 136-161, 171-185
tests/integration/test_socket.py                       159      5     42      1    97%   136-139, 232
tests/integration/test_tracing.py                      529      2    174      4    99%   294, 999->exit, 1008->exit, 1022, 1036->exit, 1049->exit
tests/integration/test_tracking.py                     881     21    328     13    97%   79->77, 83, 138->136, 142, 176->174, 180, 220-221, 393->391, 397, 1484, 1542-1558, 1647->exit, 1668->exit
tests/unit/test_reader.py                               42      1     16      0    98%   64
tests/unit/test_stats_reporter.py                       74     21     18      0    66%   22-62
tests/unit/test_tracker.py                              18      2     12      2    87%   18, 33
tests/utils.py                                          72     17     26      2    72%   33-47, 81, 86, 96-100
------------------------------------------------------------------------------------------------
TOTAL                                                 6511    340   1582     90    93%

33 files skipped due to complete coverage.

Required test coverage of 90% reached. Total coverage: 93.33%

======================== 542 passed in 85.08s (0:01:25) ========================

Additional context
Add any other context about your contribution here.

@aelsayed95 aelsayed95 force-pushed the testReports branch 2 times, most recently from d351111 to 2e4f549 Compare April 24, 2023 22:25
@aelsayed95 aelsayed95 force-pushed the testReports branch 5 times, most recently from 2ed8889 to 779f2ac Compare April 25, 2023 00:35
@aelsayed95 aelsayed95 marked this pull request as ready for review April 25, 2023 15:37
Add simple and basic smoke tests for `memray summary`, `memray tree`,
and `memray stats` to improve code coverage.

Signed-off-by: Aya Elsayed <ayah.ehab11@gmail.com>
Signed-off-by: Aya Elsayed <ayah.ehab11@gmail.com>
Signed-off-by: Aya Elsayed <ayah.ehab11@gmail.com>
Copy link
Contributor

@godlygeek godlygeek left a comment

Choose a reason for hiding this comment

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

LGTM

@godlygeek godlygeek enabled auto-merge (rebase) April 25, 2023 16:20
@godlygeek godlygeek merged commit 019a72d into bloomberg:main Apr 25, 2023
26 checks passed
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.

None yet

2 participants