Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Improve error reporting in the "try_run" function and correctly include original command output in the error message #153

Merged
merged 7 commits into from
Sep 9, 2020

Conversation

Kami
Copy link
Contributor

@Kami Kami commented Jul 25, 2018

This pull request fixes check_output function to correctly include output of the command which ran in the CalledProcessError exception which is thrown.

In addition to that, it also includes return (exit) code in the printed error message.

Before this change it was very hard / impossible to debug various codecove command failures because the original command output was not included in the error which is printed to the console.

Before (as you can see, output is always None which makes troubleshooting practically impossible):

      _____          _
     / ____|        | |
    | |     ___   __| | ___  ___ _____   __
    | |    / _ \ / _  |/ _ \/ __/ _ \ \ / /
    | |___| (_) | (_| |  __/ (_| (_) \ V /
     \_____\___/ \____|\___|\___\___/ \_/
                                    v2.0.15
==> Detecting CI provider
    Travis Detected
==> Preparing upload
==> Processing gcov (disable by -X gcov)
    Executing gcov (find /home/travis/build/StackStorm/st2 -not -path './bower_components/**' -not -path './node_modules/**' -not -path './vendor/**' -type f -name '*.gcno'  -exec gcov -pb  {} +)
==> Collecting reports
    Mergeing coverage reports
    Error running `coverage combine -a`: None
Error: No coverage report found
Tip: See an example python repo: https://github.com/codecov/example-python
Support channels:
  Email:   hello@codecov.io
  IRC:     #codecov
  Gitter:  https://gitter.im/codecov/support
  Twitter: @codecov

After (command output is correctly included which makes troubleshooting possible / easier):

      _____          _
     / ____|        | |
    | |     ___   __| | ___  ___ _____   __
    | |    / _ \ / _  |/ _ \/ __/ _ \ \ / /
    | |___| (_) | (_| |  __/ (_| (_) \ V /
     \_____\___/ \____|\___|\___\___/ \_/
                                    v2.0.15
==> Detecting CI provider
    Travis Detected
    Fixing merge commit SHA
==> Preparing upload
==> Processing gcov (disable by -X gcov)
    Executing gcov (find /home/travis/build/StackStorm/st2 -not -path './bower_components/**' -not -path './node_modules/**' -not -path './vendor/**' -type f -name '*.gcno'  -exec gcov -pb  {} +)
==> Collecting reports
    Mergeing coverage reports
    Error running `coverage combine -a`: output=Couldn't trace with concurrency=eventlet, the module isn't installed.
, returncode=1
Error: No coverage report found
Tip: See an example python repo: https://github.com/codecov/example-python
Support channels:
  Email:   hello@codecov.io
  IRC:     #codecov
  Gitter:  https://gitter.im/codecov/support
  Twitter: @codecov

@@ -171,7 +171,7 @@ def check_output(cmd, **popen_args):
process = Popen(cmd, stdout=PIPE, **popen_args)
output, _ = process.communicate()
if process.returncode:
raise CalledProcessError(process.returncode, cmd)
raise CalledProcessError(process.returncode, cmd, output)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Kami
Copy link
Contributor Author

Kami commented Jan 21, 2019

Any progress on this?

We still need to use our fork and not upstream version because this change hasn't been accepted / merged upstream yet.

Thanks.

@hootener
Copy link

I'll bring in @thomasrockhu as point of contact for getting this merged. However it seems like appveyor is failing for every build?

@thomasrockhu
Copy link
Contributor

@Kami we are working on getting the appveyor tests passing. We will get this merged ASAP

codecov/__init__.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 9, 2020

Codecov Report

Merging #153 into master will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff          @@
##           master   #153   +/-   ##
=====================================
  Coverage      88%    88%           
=====================================
  Files           2      2           
  Lines           9      9           
=====================================
  Hits            8      8           
  Misses          1      1           

@thomasrockhu thomasrockhu merged commit 6638881 into codecov:master Sep 9, 2020
@thomasrockhu
Copy link
Contributor

Thank you for this @Kami!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants