Skip to content

Commit

Permalink
feat: drop support for python 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKevJames committed Apr 26, 2024
1 parent 03cdc30 commit f8ef582
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 36 deletions.
4 changes: 0 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ workflows:

test-cpython:
jobs:
- toxpy:
name: test-py3.5
docker_image: '3.5'
tox_environment: py35
- toxpy:
name: test-py3.6-cov<<matrix.cov_version>>
docker_image: '3.6'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
max-parallel: 6
matrix:
python-version: ['3.5', '3.6', '3.7', '3.8', '3.9', '3.10']
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']

steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ ci:
autofix_commit_msg: 'refactor(lint): apply automatic lint fixes'
autoupdate_commit_msg: 'chore(deps): bump pre-commit linter versions'

default_language_version:
python: python3.7

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
Expand Down Expand Up @@ -58,7 +61,6 @@ repos:
- -d too-few-public-methods
- -d ungrouped-imports # conflicts with reorder-python-imports
- -d wrong-import-order # conflicts with reorder-python-imports
- -d consider-using-f-string # not py35 compatible
- -d unspecified-encoding # TODO: reevaluate
- -d disallowed-name # TODO: fix
exclude: example/.*
Expand All @@ -70,13 +72,13 @@ repos:
rev: v3.9.0
hooks:
- id: reorder-python-imports
args: [--py3-plus]
args: [--py36-plus]
exclude: nonunicode/.*
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.2
hooks:
- id: pyupgrade
args: [--py3-plus]
args: [--py36-plus]
exclude: nonunicode/.*
- repo: https://github.com/asottile/yesqa
rev: v1.4.0
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ sudo: false

language: python
python:
- 3.5
- 3.6
- 3.7
- 3.8
Expand Down
24 changes: 12 additions & 12 deletions coveralls/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ def ensure_token(self):
'your step config.')

raise CoverallsException(
'Not on TravisCI. You have to provide either repo_token in {} or '
'set the COVERALLS_REPO_TOKEN env var.'.format(
self.config_filename))
'Not on TravisCI. You have to provide either repo_token in '
f'{self.config_filename} or set the COVERALLS_REPO_TOKEN env var.')

def load_config(self, kwargs, service_name):
"""
Expand Down Expand Up @@ -257,7 +256,7 @@ def wear(self, dry_run=False):
return self.submit_report(json_string)

def submit_report(self, json_string):
endpoint = '{}/api/v1/jobs'.format(self._coveralls_host.rstrip('/'))
endpoint = f'{self._coveralls_host.rstrip("/")}/api/v1/jobs'
verify = not bool(os.environ.get('COVERALLS_SKIP_SSL_VERIFY'))
response = requests.post(endpoint, files={'json_file': json_string},
verify=verify)
Expand All @@ -273,10 +272,11 @@ def submit_report(self, json_string):
if os.environ.get('GITHUB_REPOSITORY'):
new_id = None
else:
new_id = '{}-{}'.format(
self.config.get('service_job_id', 42),
random.randint(0, sys.maxsize))
print('resubmitting with id {}'.format(new_id))
new_id = '-'.join((
self.config.get('service_job_id', '42'),
str(random.randint(0, sys.maxsize)),
))
print(f'resubmitting with id {new_id}')

self.config['service_job_id'] = new_id
self._data = None # force create_report to use updated data
Expand All @@ -291,7 +291,7 @@ def submit_report(self, json_string):
return response.json()
except Exception as e:
raise CoverallsException(
'Could not submit coverage: {}'.format(e)) from e
f'Could not submit coverage: {e}') from e

# https://docs.coveralls.io/parallel-build-webhook
def parallel_finish(self):
Expand All @@ -308,19 +308,19 @@ def parallel_finish(self):
# Github Actions only
payload['repo_name'] = os.environ.get('GITHUB_REPOSITORY')

endpoint = '{}/webhook'.format(self._coveralls_host.rstrip('/'))
endpoint = f'{self._coveralls_host.rstrip("/")}/webhook'
verify = not bool(os.environ.get('COVERALLS_SKIP_SSL_VERIFY'))
response = requests.post(endpoint, json=payload, verify=verify)
try:
response.raise_for_status()
response = response.json()
except Exception as e:
raise CoverallsException(
'Parallel finish failed: {}'.format(e)) from e
f'Parallel finish failed: {e}') from e

if 'error' in response:
e = response['error']
raise CoverallsException('Parallel finish failed: {}'.format(e))
raise CoverallsException(f'Parallel finish failed: {e}')

if 'done' not in response or not response['done']:
raise CoverallsException('Parallel finish failed')
Expand Down
6 changes: 3 additions & 3 deletions coveralls/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ def run_command(*args):

if cmd.returncode != 0:
raise CoverallsException(
'command return code {}, STDOUT: "{}"\nSTDERR: "{}"'.format(
cmd.returncode, stdout, stderr))
f'command returned code {cmd.returncode}, STDOUT: "{stdout}"\n'
f'STDERR: "{stderr}"')

return stdout.decode().strip()


def gitlog(fmt):
glog = run_command('git', '--no-pager', 'log', '-1',
'--pretty=format:{}'.format(fmt))
f'--pretty=format:{fmt}')

return str(glog)

Expand Down
3 changes: 1 addition & 2 deletions coveralls/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ def report5(self, cov):
# should_be_python() method.
if fr.should_be_python():
if config.ignore_errors:
msg = "Couldn't parse Python file '{}'".format(
fr.filename)
msg = f"Couldn't parse Python file '{fr.filename}'"
cov._warn(msg, # pylint: disable=W0212
slug='couldnt-parse')
else:
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/tox.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Running coveralls-python from within a `tox`_ environment (v2.0 and above) requi
For example, on TravisCI::

[tox]
envlist = py34,py35,py36,py37,py38
envlist = py310,py311,py312

[testenv]
passenv = TRAVIS TRAVIS_*
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
'coveralls = coveralls.cli:main',
],
},
python_requires='>= 3.5',
python_requires='>= 3.6',
install_requires=[
'coverage>=4.1,<7.0,!=6.0.*,!=6.1,!=6.1.1',
'docopt>=0.6.1',
Expand All @@ -49,7 +49,6 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
Expand Down
4 changes: 2 additions & 2 deletions tests/api/reporter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def make_test_results(with_branches=False, name_prefix=''):
' print(\'condition tested both ways\')\n'
' if cond2:\n'
' print(\'condition not tested both ways\')\n'),
'name': '{}project.py'.format(name_prefix),
'name': f'{name_prefix}project.py',
'coverage': [1, 1, None, None, 1, None, None,
None, 1, 0, None, 1, 1, 1, 1, 1]}, {
'source': ('from project import branch\n'
Expand All @@ -60,7 +60,7 @@ def make_test_results(with_branches=False, name_prefix=''):
' hello()\n'
' branch(False, True)\n'
' branch(True, True)\n'),
'name': '{}runtests.py'.format(name_prefix),
'name': f'{name_prefix}runtests.py',
'coverage': [1, 1, None, 1, 1, 1, 1]})
if with_branches:
results[0]['branches'] = [13, 0, 14, 1, 13, 0, 15, 1, 15, 0, 16, 1,
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
def nuke_coverage():
for folder in ('.', './example', './nonunicode'):
try:
os.remove('{}/.coverage'.format(folder))
os.remove(f'{folder}/.coverage')
except FileNotFoundError:
pass
4 changes: 2 additions & 2 deletions tests/git_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def setUp(self):

subprocess.call(['git', 'init'], cwd=self.dir)
subprocess.call(['git', 'config', 'user.name',
'"{}"'.format(GIT_NAME)], cwd=self.dir)
f'"{GIT_NAME}"'], cwd=self.dir)
subprocess.call(['git', 'config', 'user.email',
'"{}"'.format(GIT_EMAIL)], cwd=self.dir)
f'"{GIT_EMAIL}"'], cwd=self.dir)
subprocess.call(['git', 'add', 'README'], cwd=self.dir)
subprocess.call(['git', 'commit', '-m', GIT_COMMIT_MSG], cwd=self.dir)
subprocess.call(['git', 'remote', 'add', GIT_REMOTE, GIT_URL],
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
[tox]
envlist = py35-cov41-{default,pyyaml},py{36,37,38,39,310,py3}-cov{41,5,6}-{default,pyyaml}
envlist = py{36,37,38,39,310,py3}-cov{41,5,6}-{default,pyyaml}

[gh-actions]
python =
3.5: py35
3.6: py36-cov6
3.7: py37-cov6
3.8: py38-cov6
Expand Down

0 comments on commit f8ef582

Please sign in to comment.