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

Commit

Permalink
Merge pull request #260 from codecov/black-linting
Browse files Browse the repository at this point in the history
Black code formatting
  • Loading branch information
thomasrockhu committed May 22, 2020
2 parents 5302d5f + 098c82b commit 6ba8cbc
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 33 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -26,6 +26,7 @@ matrix:
- python-mock
- python: 3.7
dist: xenial
script: make format

install:
- pip install -r tests/requirements.txt
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion 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] |
| ------------------------ | ------------- | --------------------- |
Expand Down
35 changes: 21 additions & 14 deletions codecov/__init__.py
Expand Up @@ -40,7 +40,7 @@
logging.captureWarnings(True)


version=__version__
version = __version__

COLOR = True

Expand Down Expand Up @@ -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))

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand Down
17 changes: 8 additions & 9 deletions 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"
16 changes: 8 additions & 8 deletions setup.py
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tests/requirements.txt
Expand Up @@ -5,3 +5,4 @@ pytest>=3.6.0
pytest-cov
funcsigs
requests
black ; python_version >= '3.7'
5 changes: 4 additions & 1 deletion tests/test.py
Expand Up @@ -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):
Expand Down

0 comments on commit 6ba8cbc

Please sign in to comment.