facebookincubator / ptr

Python Test Runner.
MIT License
284 stars 15 forks source link

Handle coverage having floats + BrPart in report output #107

Open cooperlees opened 3 years ago

cooperlees commented 3 years ago

How is ptr not doing what you expect?

Seems we need to handle "exit" in the coverage output

What is your suggestion to make this better?

Handle it and not crash!

Code/Bug example?

/Users/cooper/repos/ansible_shed/setup.py:
Name                         Stmts   Miss Branch BrPart     Cover   Missing
---------------------------------------------------------------------------
ansible_shed/main.py            33     13      2      1    60.00%   22-27, 31, 35, 39-43, 77-78, 82
ansible_shed/tests/base.py      10      0      2      1    91.67%   19->exit
---------------------------------------------------------------------------
TOTAL                           43     13      4      2    68.09%

Traceback (most recent call last):
  File "/tmp/tas/bin/ptr", line 8, in <module>
    sys.exit(main())
  File "/private/tmp/tas/lib/python3.8/site-packages/ptr.py", line 1097, in main
    loop.run_until_complete(
  File "/opt/homebrew/Cellar/python38/3.8.3_1/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/private/tmp/tas/lib/python3.8/site-packages/ptr.py", line 1000, in async_main
    return await run_tests(
  File "/private/tmp/tas/lib/python3.8/site-packages/ptr.py", line 949, in run_tests
    await asyncio.gather(*consumers)
  File "/private/tmp/tas/lib/python3.8/site-packages/ptr.py", line 693, in _test_runner
    test_fail_result, steps_ran = await _test_steps_runner(
  File "/private/tmp/tas/lib/python3.8/site-packages/ptr.py", line 653, in _test_steps_runner
    a_test_result = _analyze_coverage(
  File "/private/tmp/tas/lib/python3.8/site-packages/ptr.py", line 180, in _analyze_coverage
    int(sl[1]), int(sl[2]), int(sl[3][:-1]), sl[4]
ValueError: invalid literal for int() with base 10: ''

How can a developer reproduce this?

Unsure as of now. Need to read coverage docs to understand what "exit" 100% means.