diff --git a/.travis.yml b/.travis.yml index 28c4c162..2e6150f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,7 @@ matrix: - python-mock - python: 3.7 dist: xenial + script: make format install: - pip install -r tests/requirements.txt diff --git a/Makefile b/Makefile index cd09f059..b166e62e 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ reinstall: test: py.test tests/test.py +format: + black . --check + compare: hub compare $(shell git tag --sort=refname | tail -1)...master diff --git a/README.md b/README.md index 8d808b0f..fe8adbd6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Codecov Global Python Uploader ![PyPI](https://img.shields.io/pypi/v/codecov) [![codecov.io](https://codecov.io/github/codecov/codecov-python/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-python) +Codecov Global Python Uploader ![PyPI](https://img.shields.io/pypi/v/codecov) [![codecov.io](https://codecov.io/github/codecov/codecov-python/coverage.svg?branch=master)](https://codecov.io/github/codecov/codecov-python) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) ======= | [https://codecov.io/][1] | [@codecov][2] | [hello@codecov.io][3] | | ------------------------ | ------------- | --------------------- | diff --git a/codecov/__init__.py b/codecov/__init__.py index 42e38aa6..2ac36114 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -40,7 +40,7 @@ logging.captureWarnings(True) -version=__version__ +version = __version__ COLOR = True @@ -902,17 +902,24 @@ def main(*argv, **kwargs): write("XX> Skip processing gcov") else: - dont_search_here = [ - "bower_components" - "node_modules" - "vendor" - ] + dont_search_here = ["bower_components" "node_modules" "vendor"] if codecov.gcov_glob: dont_search_here.append(codecov.gcov_glob) write("==> Processing gcov (disable by -X gcov)") - for path in find_files(sanitize_arg("", codecov.gcov_root or root), "*.gcno", True, dont_search_here): - cmd = sanitize_arg("", codecov.gcov_exec or "") + " -pb " + sanitize_arg("", codecov.gcov_args or "") + " " + path + for path in find_files( + sanitize_arg("", codecov.gcov_root or root), + "*.gcno", + True, + dont_search_here, + ): + cmd = ( + sanitize_arg("", codecov.gcov_exec or "") + + " -pb " + + sanitize_arg("", codecov.gcov_args or "") + + " " + + path + ) write(" Executing gcov (%s)" % cmd) write(try_to_run(cmd)) @@ -1056,8 +1063,8 @@ def main(*argv, **kwargs): headers={ "Accept": "text/plain", "X-Reduced-Redundancy": "false", - "X-Content-Type": "application/x-gzip" - } + "X-Content-Type": "application/x-gzip", + }, ) if res.status_code in (400, 406): raise Exception(res.text) @@ -1073,8 +1080,8 @@ def main(*argv, **kwargs): data=reports_gzip, headers={ "Content-Type": "application/x-gzip", - "Content-Encoding": "gzip" - } + "Content-Encoding": "gzip", + }, ) s3.raise_for_status() assert s3.status_code == 200 @@ -1096,8 +1103,8 @@ def main(*argv, **kwargs): headers={ "Accept": "text/plain", "Content-Type": "application/x-gzip", - "Content-Encoding": "gzip" - } + "Content-Encoding": "gzip", + }, ) if res.status_code < 500: write(" " + res.text) diff --git a/codecov/__version__.py b/codecov/__version__.py index f33db7ec..3955eb75 100644 --- a/codecov/__version__.py +++ b/codecov/__version__.py @@ -1,9 +1,8 @@ -__author__ = 'Codecov' -__author_email__ = 'support@codecov.io' -__copyright__ = 'Copyright 2020 Codecov' -__description__ = 'Hosted coverage reports for GitHub, Bitbucket and Gitlab' -__license__ = 'Apache 2.0' -__title__ = 'codecov' -__url__ = 'https://github.com/codecov/codecov-python' -__version__ = '2.1.3' - +__author__ = "Codecov" +__author_email__ = "support@codecov.io" +__copyright__ = "Copyright 2020 Codecov" +__description__ = "Hosted coverage reports for GitHub, Bitbucket and Gitlab" +__license__ = "Apache 2.0" +__title__ = "codecov" +__url__ = "https://github.com/codecov/codecov-python" +__version__ = "2.1.3" diff --git a/setup.py b/setup.py index 1e8f0dc3..4d418234 100644 --- a/setup.py +++ b/setup.py @@ -23,20 +23,20 @@ filepath = os.path.abspath(os.path.dirname(__file__)) about = {} -with open(os.path.join(filepath, 'codecov', '__version__.py'), 'r', 'utf-8') as f: +with open(os.path.join(filepath, "codecov", "__version__.py"), "r", "utf-8") as f: exec(f.read(), about) setup( - name=about['__title__'], - version=about['__version__'], - description=about['__description__'], + name=about["__title__"], + version=about["__version__"], + description=about["__description__"], long_description=None, classifiers=classifiers, keywords="coverage codecov code python java scala php", - author=about['__author__'], - author_email=about['__author_email__'], - url=about['__url__'], - license=about['__license__'], + author=about["__author__"], + author_email=about["__author_email__"], + url=about["__url__"], + license=about["__license__"], packages=["codecov"], include_package_data=True, zip_safe=True, diff --git a/tests/requirements.txt b/tests/requirements.txt index 62de37c5..f70ccf3f 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -5,3 +5,4 @@ pytest>=3.6.0 pytest-cov funcsigs requests +black ; python_version >= '3.7' diff --git a/tests/test.py b/tests/test.py index 3c396be9..279d21ec 100644 --- a/tests/test.py +++ b/tests/test.py @@ -269,7 +269,10 @@ def test_send(self): assert "token=%3Ctoken%3E" in post.call_args[0][0] assert "branch=master" in post.call_args[0][0] gzip_worker = zlib.decompressobj(zlib.MAX_WBITS | 16) - reports = gzip_worker.decompress(put.call_args[1]["data"]) + gzip_worker.flush() + reports = ( + gzip_worker.decompress(put.call_args[1]["data"]) + + gzip_worker.flush() + ) assert u"tests/test.py".encode("utf-8") in reports def test_send_error(self):