From fad5e4cd06b27b29c484dd90a6555d678a3385ab Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 24 Aug 2017 16:42:08 +0200 Subject: [PATCH 01/28] Implement --verbose: write the collected reports This is similar to --dump (for now), but will also upload. --- codecov/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index cedb314b..61ab50df 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -230,7 +230,7 @@ def main(*argv, **kwargs): debugging = parser.add_argument_group('======================== Debugging ========================') debugging.add_argument('--dump', action="store_true", help="Dump collected data and do not send to Codecov") - debugging.add_argument('-v', '--verbose', action="store_true", help="No comfigured yet") + debugging.add_argument('-v', '--verbose', action="store_true", help="Be verbose, e.g. dump the collected data") debugging.add_argument('--no-color', action="store_true", help="Do not output with color") # Parse Arguments @@ -700,6 +700,10 @@ def main(*argv, **kwargs): write('==> Uploading') write(' .url ' + codecov.url) write(' .query ' + remove_token('token=', urlargs)) + if codecov.verbose: + write('-------------------- Reports --------------------') + write(reports) + write('-------------------------------------------------') s3 = None trys = 0 From fcdaa7b9f9d297133d80c9bf1e02bbb3dc9587f7 Mon Sep 17 00:00:00 2001 From: William Pennock Date: Tue, 27 Feb 2018 12:15:36 -0500 Subject: [PATCH 02/28] Update README.md I proposed putting brackets around "the-repository-upload-token", so that it would be clear to users that this is something they need to add. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 59e03699..64846082 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,11 @@ Find coverage reports for all the [languages below](#languages), gather them and ## Usage ```sh -pip install --user codecov && codecov -t the-repository-upload-token +pip install --user codecov && codecov -t ``` or ```sh -conda install -c conda-forge codecov && codecov -t the-repository-upload-token +conda install -c conda-forge codecov && codecov -t ``` > `--user` argument not needed for Python projects. [See example here](https://github.com/codecov/example-python). From c124f57d805e4936f8b07d6f4a9a2fb59ab9d88c Mon Sep 17 00:00:00 2001 From: Jimmy Wilson Date: Mon, 23 Apr 2018 15:58:46 -0500 Subject: [PATCH 03/28] Correct typo "Mergeing" -> "Merging" --- codecov/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index 82e12136..ba8234b7 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -666,7 +666,7 @@ def main(*argv, **kwargs): # ----------------------------------------- # Ran from current directory if glob.glob(opj(os.getcwd(), '.coverage.*')): - write(' Mergeing coverage reports') + write(' Merging coverage reports') # The `-a` option is mandatory here. If we # have a `.coverage` in the current directory, calling # without the option would delete the previous data From 331d4af160749785b578359ef29e3cec922aa35d Mon Sep 17 00:00:00 2001 From: Oliver Bestwalter Date: Sun, 3 Jun 2018 00:20:14 +0200 Subject: [PATCH 04/28] CODECOV_ env need to be in tox passenv From https://github.com/tox-dev/tox-travis/issues/106 it became clear that the lack of explicit mention in passenv is confusing to the user. They might think that `CODECOV_*` env vars are automatically passed through. As tox only passes through the absolute minimum necessary `CODECOV_*` has to be added to passenv also. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 59e03699..d74ba55a 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Just please make sure to pass all the necessary environment variables through: ``` [testenv] -passenv = TOXENV CI TRAVIS TRAVIS_* +passenv = TOXENV CI TRAVIS TRAVIS_* CODECOV_* deps = codecov>=1.4.0 commands = codecov -e TOXENV ``` From 63afb8417d822c7d5722969e67985e1d7759503f Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 14 Jan 2019 12:05:58 -0600 Subject: [PATCH 05/28] update to support Appveyor Ubuntu image, which has lower case 'true's in the environment variable strings --- codecov/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index 82e12136..c476da66 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -405,7 +405,7 @@ def main(*argv, **kwargs): # -------- # AppVeyor # -------- - elif os.getenv('CI') == "True" and os.getenv('APPVEYOR') == 'True': + elif os.getenv('CI').lower() == "true" and os.getenv('APPVEYOR').lower() == 'true': # http://www.appveyor.com/docs/environment-variables query.update(dict(branch=os.getenv('APPVEYOR_REPO_BRANCH'), service="appveyor", From e19da89a0db82e179ae658a20d15aeda08dd342a Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Mon, 14 Jan 2019 13:50:12 -0600 Subject: [PATCH 06/28] handle the case the env variable is not present and make sure we don't call lower on NoneType --- codecov/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index c476da66..1ec0261c 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -405,7 +405,7 @@ def main(*argv, **kwargs): # -------- # AppVeyor # -------- - elif os.getenv('CI').lower() == "true" and os.getenv('APPVEYOR').lower() == 'true': + elif os.getenv('CI', 'false').lower() == 'true' and os.getenv('APPVEYOR', 'false').lower() == 'true': # http://www.appveyor.com/docs/environment-variables query.update(dict(branch=os.getenv('APPVEYOR_REPO_BRANCH'), service="appveyor", From a6f411280df50f0f3e715bb858105d9e830e7f25 Mon Sep 17 00:00:00 2001 From: Thomas Hu Date: Sat, 19 Jan 2019 12:37:10 -0500 Subject: [PATCH 07/28] Pin pytest to 3.6.0 to work with pytest-cov --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 7a8e6842..0571ca62 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,7 +1,7 @@ coverage ddt mock -pytest +pytest>=3.6.0 pytest-cov funcsigs requests From ad4cc424e354661b3569ae87bc64e998bda4be0a Mon Sep 17 00:00:00 2001 From: Thomas Hu Date: Sat, 19 Jan 2019 12:44:59 -0500 Subject: [PATCH 08/28] Upgrade coverage to 4.4.0 --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 0571ca62..1c022ee8 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,4 +1,4 @@ -coverage +coverage>=4.4.0 ddt mock pytest>=3.6.0 From 939643497009251bb1f768537eee5a2ce551d2f9 Mon Sep 17 00:00:00 2001 From: Thomas Hu Date: Tue, 22 Jan 2019 17:22:18 -0500 Subject: [PATCH 09/28] Update copyright --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d74ba55a..9571885a 100644 --- a/README.md +++ b/README.md @@ -102,4 +102,4 @@ after_success: ## Copyright -> Copyright 2014-2017 codecov +> Copyright 2014-2019 codecov From 9b24833a51e30dc9b3dcf70637fafa9294f4865a Mon Sep 17 00:00:00 2001 From: Thomas Hu Date: Tue, 22 Jan 2019 17:50:21 -0500 Subject: [PATCH 10/28] Switch to ubuntu --- .gitignore | 1 + .travis.yml | 2 +- appveyor.yml | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 79d2d87e..433e02bb 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ coverage.xml dist htmlcov venv +*.sw[op] diff --git a/.travis.yml b/.travis.yml index 4dc412bf..f802b33d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ python: - pypy - 3.4 - 3.5 - - 3.6 + - 3.6 - pypy3 matrix: include: diff --git a/appveyor.yml b/appveyor.yml index a4c6b26e..3bda77c7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,5 @@ +image: ubuntu + environment: global: APPVEYOR_PYTHON_URL: "https://raw.githubusercontent.com/ogrisel/python-appveyor-demo/master/appveyor/" From b6b52828f82c1f7dd8ab676116ad6d42b94b2516 Mon Sep 17 00:00:00 2001 From: Thomas Hu Date: Tue, 22 Jan 2019 23:24:02 -0500 Subject: [PATCH 11/28] Skip failing AppVeyor test due to file path issue on Windows --- appveyor.yml | 2 -- tests/test.py | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 3bda77c7..a4c6b26e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,3 @@ -image: ubuntu - environment: global: APPVEYOR_PYTHON_URL: "https://raw.githubusercontent.com/ogrisel/python-appveyor-demo/master/appveyor/" diff --git a/tests/test.py b/tests/test.py index 5d3f23e2..67a1de98 100644 --- a/tests/test.py +++ b/tests/test.py @@ -204,6 +204,7 @@ def test_disable_search(self): else: raise Exception("Did not raise AssertionError") + @unittest.skipIf(os.getenv('CI') == "True" and os.getenv('APPVEYOR') == 'True', 'Skip AppVeyor CI test') def test_prefix(self): self.fake_report() res = self.run_cli(prefix='/foo/bar/', dump=True, token='a', branch='b', commit='c') From 483b9a4331aa03d0eb43ad6ad5b05b984ffdc5b3 Mon Sep 17 00:00:00 2001 From: Thomas Hu Date: Tue, 22 Jan 2019 23:31:31 -0500 Subject: [PATCH 12/28] Remove deprecated python versions and add new ones --- appveyor.yml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a4c6b26e..88cac480 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,35 +13,37 @@ environment: # a later point release. - PYTHON: "C:\\Python27" - PYTHON_VERSION: "2.7.x" # currently 2.7.9 + PYTHON_VERSION: "2.7.x" # currently 2.7.15 PYTHON_ARCH: "32" - PYTHON: "C:\\Python27-x64" - PYTHON_VERSION: "2.7.x" # currently 2.7.9 + PYTHON_VERSION: "2.7.x" # currently 2.7.15 PYTHON_ARCH: "64" - - PYTHON: "C:\\Python33" - PYTHON_VERSION: "3.3.x" # currently 3.3.5 + - PYTHON: "C:\\Python34" + PYTHON_VERSION: "3.4.x" # currently 3.4.4 PYTHON_ARCH: "32" - - PYTHON: "C:\\Python33-x64" - PYTHON_VERSION: "3.3.x" # currently 3.3.5 + - PYTHON: "C:\\Python34-x64" + PYTHON_VERSION: "3.4.x" # currently 3.4.4 PYTHON_ARCH: "64" - - PYTHON: "C:\\Python34" - PYTHON_VERSION: "3.4.x" # currently 3.4.3 + - PYTHON: "C:\\Python36" + PYTHON_VERSION: "3.6.x" # currently 3.6.6 PYTHON_ARCH: "32" - - PYTHON: "C:\\Python34-x64" - PYTHON_VERSION: "3.4.x" # currently 3.4.3 + - PYTHON: "C:\\Python36-x64" + PYTHON_VERSION: "3.6.x" # currently 3.6.6 PYTHON_ARCH: "64" - # Also test Python 2.6.6 not pre-installed - - - PYTHON: "C:\\Python266" - PYTHON_VERSION: "2.6.6" + - PYTHON: "C:\\Python37" + PYTHON_VERSION: "3.7.x" # currently 3.7.1 PYTHON_ARCH: "32" + - PYTHON: "C:\\Python37-x64" + PYTHON_VERSION: "3.7.x" # currently 3.7.1 + PYTHON_ARCH: "64" + install: # Download the Appveyor Python build accessories into subdirectory .\appveyor - mkdir appveyor From 8d48369bc6229f6c40a0eaa3f096b21e8ee5cdfc Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 4 Mar 2019 17:48:40 +0200 Subject: [PATCH 13/28] sudo no longer needed https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4dc412bf..a623178b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: python notifications: email: false -sudo: false + python: - 2.7 - pypy @@ -13,7 +13,6 @@ matrix: include: - python: 2.7 dist: trusty - sudo: required virtualenv: system_site_packages: true addons: From 4b111c8bf5f6b358b6a4b5b0d53000be372779f9 Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 4 Mar 2019 17:49:30 +0200 Subject: [PATCH 14/28] Drop the dot https://twitter.com/pytestdotorg/status/753767547866972160 --- .travis.yml | 2 +- tox.ini | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a623178b..1f7b71d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,6 @@ install: - pip install -r tests/requirements.txt - python setup.py install script: - - py.test tests/test.py --cov=codecov + - pytest tests/test.py --cov=codecov after_success: - codecov diff --git a/tox.ini b/tox.ini index 45fed510..c26c0ac7 100644 --- a/tox.ini +++ b/tox.ini @@ -5,4 +5,4 @@ envlist = py26, py27, py34 deps = -r{toxinidir}/tests/requirements.txt commands = - py.test tests/test.py + pytest tests/test.py From bd4822464a92158425ebfa17ed130bc685ebac8d Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 4 Mar 2019 17:52:10 +0200 Subject: [PATCH 15/28] Add support for Python 3.7 --- .travis.yml | 2 ++ setup.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 1f7b71d7..e24be156 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,8 @@ matrix: - python-requests - python-coverage - python-mock + - python: 3.7 + dist: xenial install: - pip install -r tests/requirements.txt diff --git a/setup.py b/setup.py index 5e961aeb..ead3e934 100644 --- a/setup.py +++ b/setup.py @@ -7,9 +7,13 @@ "Environment :: Plugins", "Intended Audience :: Developers", "Programming Language :: Python", + "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: PyPy", "License :: OSI Approved :: Apache Software License", "Topic :: Software Development :: Testing"] From 976e9d595dc1fb516d1e006fe835e3f57e31637c Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 4 Mar 2019 17:53:21 +0200 Subject: [PATCH 16/28] Cache pip files --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e24be156..a5f557aa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: python +cache: pip notifications: email: false From cf4d43c853c2f2dc542736c3fde5bb8da718cdb5 Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 4 Mar 2019 17:54:16 +0200 Subject: [PATCH 17/28] Add python_requires to help pip --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ead3e934..825ad589 100644 --- a/setup.py +++ b/setup.py @@ -38,4 +38,6 @@ zip_safe=True, install_requires=install_requires, tests_require=["unittest2"], - entry_points={'console_scripts': ['codecov=codecov:main']}) + entry_points={'console_scripts': ['codecov=codecov:main']}, + python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', + ) From 71735221a19cac9cc5f76f5e28df528866e753d6 Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 4 Mar 2019 18:08:40 +0200 Subject: [PATCH 18/28] Remove redundant code --- codecov/__init__.py | 8 ++------ setup.py | 9 +-------- tests/requirements.txt | 1 - tests/test.py | 2 +- tox.ini | 2 +- 5 files changed, 5 insertions(+), 17 deletions(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index 39d9a980..ae805ed9 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -22,12 +22,8 @@ import subprocess # https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning -try: - import logging - logging.captureWarnings(True) -except: - # not py2.6 compatible - pass +import logging +logging.captureWarnings(True) version = VERSION = __version__ = '2.0.15' diff --git a/setup.py b/setup.py index 825ad589..24d7ee64 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ #!/usr/bin/env python from setuptools import setup -import sys version = '2.0.15' classifiers = ["Development Status :: 5 - Production/Stable", @@ -18,11 +17,6 @@ "License :: OSI Approved :: Apache Software License", "Topic :: Software Development :: Testing"] -if sys.version_info >= (2, 7): - install_requires = ["requests>=2.7.9", "coverage"] -else: - install_requires = ["requests>=2.7.9", "coverage", "argparse"] - setup(name='codecov', version=version, description="Hosted coverage reports for Github, Bitbucket and Gitlab", @@ -36,8 +30,7 @@ packages=['codecov'], include_package_data=True, zip_safe=True, - install_requires=install_requires, - tests_require=["unittest2"], + install_requires=["requests>=2.7.9", "coverage"], entry_points={'console_scripts': ['codecov=codecov:main']}, python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', ) diff --git a/tests/requirements.txt b/tests/requirements.txt index 1c022ee8..62de37c5 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -5,4 +5,3 @@ pytest>=3.6.0 pytest-cov funcsigs requests -unittest2 diff --git a/tests/test.py b/tests/test.py index 5d3f23e2..39bb59b2 100644 --- a/tests/test.py +++ b/tests/test.py @@ -4,7 +4,7 @@ import itertools from ddt import ddt, data from mock import patch, Mock -import unittest2 as unittest +import unittest import subprocess diff --git a/tox.ini b/tox.ini index c26c0ac7..84880fa6 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py26, py27, py34 +envlist = py27, py34, py35, py36, py37 [testenv] deps = From 684ab7f8a3d99b671826ce87b2bf2618f9ece338 Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 4 Mar 2019 18:14:52 +0200 Subject: [PATCH 19/28] Fix GitHub typo --- CHANGELOG.md | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f869d2f..f7a85fc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -127,7 +127,7 @@ ### `1.1.5` - search for all `lcov|gcov` files -- depreciate `--min-coverage`, use Github Status Update feature +- depreciate `--min-coverage`, use GitHub Status Update feature - pre-process xml => json ### `1.1.4` diff --git a/setup.py b/setup.py index 24d7ee64..115e7c93 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup(name='codecov', version=version, - description="Hosted coverage reports for Github, Bitbucket and Gitlab", + description="Hosted coverage reports for GitHub, Bitbucket and Gitlab", long_description=None, classifiers=classifiers, keywords='coverage codecov code python java scala php', From a4d620be54e68ec7b63f5f4e2ef915f62f1c294e Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 4 Mar 2019 18:24:10 +0200 Subject: [PATCH 20/28] Use HTTPS --- README.md | 10 +++++----- setup.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 86eb0dd3..dbf2ddf1 100644 --- a/README.md +++ b/README.md @@ -76,19 +76,19 @@ after_success: ## CI Providers | Company | Supported | Token Required | | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | -| [Travis CI](https://travis-ci.org/) | Yes [![Build Status](https://secure.travis-ci.org/codecov/codecov-python.svg?branch=master)](http://travis-ci.org/codecov/codecov-python) | Private only | +| [Travis CI](https://travis-ci.org/) | Yes [![Build Status](https://secure.travis-ci.org/codecov/codecov-python.svg?branch=master)](https://travis-ci.org/codecov/codecov-python) | Private only | | [CircleCI](https://circleci.com/) | Yes | Private only | | [Codeship](https://codeship.com/) | Yes | Public & Private | | [Jenkins](https://jenkins-ci.org/) | Yes | Public & Private | | [Semaphore](https://semaphoreci.com/) | Yes | Public & Private | | [Drone.io](https://drone.io/) | Yes | Public & Private | -| [AppVeyor](http://www.appveyor.com/) | Yes [![Build status](https://ci.appveyor.com/api/projects/status/sw18lsj7786bw806/branch/master?svg=true)](https://ci.appveyor.com/project/stevepeak/codecov-python/branch/master) | Private only | +| [AppVeyor](https://www.appveyor.com/) | Yes [![Build status](https://ci.appveyor.com/api/projects/status/sw18lsj7786bw806/branch/master?svg=true)](https://ci.appveyor.com/project/stevepeak/codecov-python/branch/master) | Private only | | [Wercker](http://wercker.com/) | Yes | Public & Private | | [Magnum CI](https://magnum-ci.com/) | Yes | Public & Private | -| [Shippable](http://www.shippable.com/) | Yes | Public & Private | +| [Shippable](https://www.shippable.com/) | Yes | Public & Private | | [Gitlab CI](https://about.gitlab.com/gitlab-ci/) | Yes | Public & Private | -| git / mercurial | Yes (as a fallback) | Public & Private | -| [Buildbot](http://buildbot.net/) | `coming soon` [buildbot/buildbot#1671](https://github.com/buildbot/buildbot/pull/1671) | | +| Git / Mercurial | Yes (as a fallback) | Public & Private | +| [Buildbot](https://buildbot.net/) | `coming soon` [buildbot/buildbot#1671](https://github.com/buildbot/buildbot/pull/1671) | | | [Bamboo](https://www.atlassian.com/software/bamboo) | `coming soon` | | | [Solano Labs](https://www.solanolabs.com/) | `coming soon` | | diff --git a/setup.py b/setup.py index 115e7c93..639e7464 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ keywords='coverage codecov code python java scala php', author='@codecov', author_email='hello@codecov.io', - url='http://github.com/codecov/codecov-python', + url='https://github.com/codecov/codecov-python', license='http://www.apache.org/licenses/LICENSE-2.0', packages=['codecov'], include_package_data=True, From 6ad9b73bbf7f8b6d27df8b898986b878760157fe Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 4 Mar 2019 18:24:29 +0200 Subject: [PATCH 21/28] Remove redundant note: sudo no longer required on Travis CI --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index dbf2ddf1..122997e2 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,6 @@ after_success: | [Bamboo](https://www.atlassian.com/software/bamboo) | `coming soon` | | | [Solano Labs](https://www.solanolabs.com/) | `coming soon` | | -> Using **Travis CI**? Uploader is compatible with `sudo: false` which can speed up your builds. :+1: From ea42cea17859849c5dd6986bb651e9f18d70fa4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Lipt=C3=A1k?= Date: Wed, 22 May 2019 21:01:20 -0400 Subject: [PATCH 22/28] Add Python 3.7 to Travis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gábor Lipták --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index f802b33d..e9b2db75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,8 @@ + language: python notifications: email: false +dist: xenial sudo: false python: - 2.7 @@ -8,6 +10,7 @@ python: - 3.4 - 3.5 - 3.6 + - 3.7 - pypy3 matrix: include: From 3113225fa7446e211c518ce74bcb67449c76f239 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Mon, 3 Jun 2019 21:37:34 +0100 Subject: [PATCH 23/28] Better error message when try_to_run command fails The `CalledProcessError` object should always have a `.output` attribute, although it may be None, so the `getattr()` will never hit the fallback condition. The logical `or` operator should use the fallback if `e.output` is either None or an empty string, because those are both false-y. Any other possible value will be shown. --- codecov/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index 39d9a980..1dfa9ead 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -181,7 +181,7 @@ def try_to_run(cmd): try: return check_output(cmd, shell=True) except subprocess.CalledProcessError as e: - write(' Error running `%s`: %s' % (cmd, str(getattr(e, 'output', str(e))))) + write(' Error running `%s`: %s' % (cmd, e.output or str(e))) def remove_non_ascii(data): From 8660351ee9aeada349e1d6566e9021be5cf377cf Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Mon, 3 Jun 2019 21:48:52 +0100 Subject: [PATCH 24/28] Run Python 'coverage' tool as a module if possible This means coverage can still be called to convert its data to XML even if it's not on PATH. Closes #71. --- codecov/__init__.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index 39d9a980..6fd9f197 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -183,6 +183,20 @@ def try_to_run(cmd): except subprocess.CalledProcessError as e: write(' Error running `%s`: %s' % (cmd, str(getattr(e, 'output', str(e))))) +def run_python_coverage(args): + """Run the Python coverage tool + + If it's importable in this Python, launch it using 'python -m'. + Otherwise, look it up on PATH like any other command. + """ + try: + import coverage + except ImportError: + # Coverage is not installed on this Python. Hope it's on PATH. + try_to_run(['coverage'] + args) + else: + # Coverage is installed on this Python. Run it as a module. + try_to_run([sys.executable, '-m', 'coverage'] + args) def remove_non_ascii(data): try: @@ -670,12 +684,12 @@ def main(*argv, **kwargs): # The `-a` option is mandatory here. If we # have a `.coverage` in the current directory, calling # without the option would delete the previous data - try_to_run('coverage combine -a') + run_python_coverage(['combine', '-a']) if os.path.exists(opj(os.getcwd(), '.coverage')) and not os.path.exists(opj(os.getcwd(), 'coverage.xml')): write(' Generating coverage xml reports for Python') # using `-i` to ignore "No source for code" error - try_to_run('coverage xml -i') + run_python_coverage(['xml', '-i']) reports.append(read(opj(os.getcwd(), 'coverage.xml'))) reports = list(filter(bool, reports)) From 39331a6afba5a7fe178e92145dcefe7a647ebfad Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Mon, 3 Jun 2019 22:04:23 +0100 Subject: [PATCH 25/28] Run Python coverage tool with shell=False --- codecov/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index 6fd9f197..c1edd19a 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -177,9 +177,9 @@ def check_output(cmd, **popen_args): return output.decode('utf-8') -def try_to_run(cmd): +def try_to_run(cmd, shell=True): try: - return check_output(cmd, shell=True) + return check_output(cmd, shell=shell) except subprocess.CalledProcessError as e: write(' Error running `%s`: %s' % (cmd, str(getattr(e, 'output', str(e))))) @@ -193,10 +193,10 @@ def run_python_coverage(args): import coverage except ImportError: # Coverage is not installed on this Python. Hope it's on PATH. - try_to_run(['coverage'] + args) + try_to_run(['coverage'] + args, shell=False) else: # Coverage is installed on this Python. Run it as a module. - try_to_run([sys.executable, '-m', 'coverage'] + args) + try_to_run([sys.executable, '-m', 'coverage'] + args, shell=False) def remove_non_ascii(data): try: From 80a3fcc7d578d4624c2fc9210b10c14d8fb2ddde Mon Sep 17 00:00:00 2001 From: Ryan Ly Date: Tue, 12 Nov 2019 14:54:22 -0800 Subject: [PATCH 26/28] Fix broken bitly link in help --- codecov/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index ea12bf53..6b3205c3 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -230,7 +230,7 @@ def main(*argv, **kwargs): gcov.add_argument('--gcov-args', default='', help="extra arguments to pass to gcov") advanced = parser.add_argument_group('======================== Advanced ========================') - advanced.add_argument('-X', '--disable', nargs="*", default=[], help="Disable features. Accepting **search** to disable crawling through directories, **detect** to disable detecting CI provider, **gcov** disable gcov commands, `pycov` disables running python `coverage xml`, **fix** to disable report adjustments http://bit.ly/1O4eBpt") + advanced.add_argument('-X', '--disable', nargs="*", default=[], help="Disable features. Accepting **search** to disable crawling through directories, **detect** to disable detecting CI provider, **gcov** disable gcov commands, `pycov` disables running python `coverage xml`, **fix** to disable report adjustments https://docs.codecov.io/docs/fixing-reports") advanced.add_argument('--root', default=None, help="Project directory. Default: current direcory or provided in CI environment variables") advanced.add_argument('--commit', '-c', default=None, help="Commit SHA, set automatically") advanced.add_argument('--prefix', '-P', default=None, help="Prefix network paths to help resolve paths: https://github.com/codecov/support/issues/472") From 2a80aa434f74feb31242b6f213b75ce63ae97902 Mon Sep 17 00:00:00 2001 From: Joe Becher Date: Wed, 19 Feb 2020 09:36:10 -0500 Subject: [PATCH 27/28] CE-1380_sanitize_args --- codecov/__init__.py | 10 +++++++--- tests/test.py | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index 6b3205c3..40ba7a73 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -34,6 +34,10 @@ remove_token = re.compile(r'token=[^\&]+').sub +def sanitize_arg(replacement, arg): + return re.sub(r'[\&]+', replacement, arg, 0, re.MULTILINE) + + ignored_path = re.compile(r'(/vendor)|' r'(/js/generated/coverage)|' r'(/__pycache__)|' @@ -624,11 +628,11 @@ def main(*argv, **kwargs): ) write('==> Processing gcov (disable by -X gcov)') cmd = "find %s %s -type f -name '*.gcno' %s -exec %s -pb %s {} +" % ( - (codecov.gcov_root or root), + (sanitize_arg('', codecov.gcov_root or root)), dont_search_here, " ".join(map(lambda a: "-not -path '%s'" % a, codecov.gcov_glob)), - (codecov.gcov_exec or ''), - (codecov.gcov_args or '')) + (sanitize_arg('', codecov.gcov_exec or '')), + (sanitize_arg('', codecov.gcov_args or ''))) write(' Executing gcov (%s)' % cmd) try_to_run(cmd) diff --git a/tests/test.py b/tests/test.py index ed640c6e..cf001d61 100644 --- a/tests/test.py +++ b/tests/test.py @@ -315,6 +315,9 @@ def test_none_found(self): else: raise Exception("Did not raise AssertionError") + def test_sanitize_arg(self): + self.assertEqual(codecov.sanitize_arg('', '& echo test > vuln1.txt'), ' echo test > vuln1.txt') + @unittest.skipUnless(os.getenv('JENKINS_URL'), 'Skip Jenkins CI test') def test_ci_jenkins(self): self.set_env(BUILD_URL='https://....', From 3a8b06b2c7de69bfa6a7fa8eb2517df558b39342 Mon Sep 17 00:00:00 2001 From: Joe Becher Date: Mon, 24 Feb 2020 13:26:08 -0500 Subject: [PATCH 28/28] Version 2.0.16 --- CHANGELOG.md | 3 +++ setup.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7a85fc1..a7c25289 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### `2.0.16` +- fixed reported command injection vulnerability. + ### `2.0.15` - add `-X s3` to disable direct to S3 uploading diff --git a/setup.py b/setup.py index 639e7464..2800c7b1 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from setuptools import setup -version = '2.0.15' +version = '2.0.16' classifiers = ["Development Status :: 5 - Production/Stable", "Environment :: Plugins", "Intended Audience :: Developers",