Skip to content

Commit 1ea6e85

Browse files
author
Sylvain MARIE
committed
Updated CI/CD template: added flake8 session, and now generating badges using genbadge
1 parent 39f0c23 commit 1ea6e85

File tree

11 files changed

+94
-221
lines changed

11 files changed

+94
-221
lines changed

.github/workflows/base.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ jobs:
117117
- run: conda list
118118
shell: bash -l {0} # so that conda works
119119

120+
# 5) Run the flake8 report and badge
121+
- name: Run flake8 analysis and generate corresponding badge
122+
shell: bash -l {0} # so that conda works
123+
run: nox -s flake8
120124

121125
# -------------- only on Ubuntu + MAIN PUSH (no pull request, no tag) -----------
122126

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Separate test code from test cases in `pytest`.
44

5-
[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-2%20%7C%203%20%7C%204%20%7C%205%20%7C%206-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](https://smarie.github.io/python-pytest-cases/reports/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases)
5+
[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-2%20%7C%203%20%7C%204%20%7C%205%20%7C%206-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](https://smarie.github.io/python-pytest-cases/reports/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/junit/report.html) [![Coverage Status](https://smarie.github.io/python-pytest-cases/reports/coverage/coverage-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/coverage/index.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases) [![Flake8 Status](https://smarie.github.io/python-pytest-cases/reports/flake8/flake8-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/flake8/index.html)
66

77
[![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-pytest-cases/) [![PyPI](https://img.shields.io/pypi/v/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) [![Downloads](https://pepy.tech/badge/pytest-cases)](https://pepy.tech/project/pytest-cases) [![Downloads per week](https://pepy.tech/badge/pytest-cases/week)](https://pepy.tech/project/pytest-cases) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-pytest-cases.svg)](https://github.com/smarie/python-pytest-cases/stargazers) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3937829.svg)](https://doi.org/10.5281/zenodo.3937829)
88

ci_tools/flake8-requirements.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
setuptools_scm>=3,<4
2+
flake8>=3.6,<4
3+
flake8-html>=0.4,<1
4+
flake8-bandit>=2.1.1,<3
5+
flake8-bugbear>=20.1.0,<21.0.0
6+
flake8-docstrings>=1.5,<2
7+
flake8-print>=3.1.1,<4
8+
flake8-tidy-imports>=4.2.1,<5
9+
flake8-copyright==0.2.2 # Internal forked repo to fix an issue, keep specific version
10+
pydocstyle>=5.1.1,<6
11+
pycodestyle>=2.6.0,<3
12+
mccabe>=0.6.1,<1
13+
naming>=0.5.1,<1
14+
pyflakes>=2.2,<3
15+
genbadge[flake8]

ci_tools/generate-junit-badge.py

Lines changed: 0 additions & 112 deletions
This file was deleted.

ci_tools/headers.tmpl

Lines changed: 0 additions & 4 deletions
This file was deleted.

ci_tools/headers_check.py

Lines changed: 0 additions & 80 deletions
This file was deleted.

ci_tools/nox_utils.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def install_reqs(
149149
setup=False,
150150
install=False,
151151
tests=False,
152+
extras=(),
152153
# custom phase
153154
phase=None,
154155
phase_reqs=None,
@@ -161,6 +162,7 @@ def install_reqs(
161162
- setup.cfg "[options] setup_requires" (if setup=True)
162163
- setup.cfg "[options] install_requires" (if install=True)
163164
- setup.cfg "[options] test_requires" (if tests=True)
165+
- setup.cfg "[options.extras_require] <...>" (if extras=(a tuple of extras))
164166
165167
Two additional mechanisms are provided in order to customize how packages are installed.
166168
@@ -208,6 +210,10 @@ def install_reqs(
208210
self.install_any("setup.cfg#tests_requires", setup_cfg.tests_requires,
209211
use_conda_for=toml_use_conda_for, versions_dct=versions_dct)
210212

213+
for extra in extras:
214+
self.install_any("setup.cfg#extras_require#%s" % extra, setup_cfg.extras_require[extra],
215+
use_conda_for=toml_use_conda_for, versions_dct=versions_dct)
216+
211217
if phase is not None:
212218
self.install_any(phase, phase_reqs, use_conda_for=toml_use_conda_for, versions_dct=versions_dct)
213219

@@ -321,7 +327,7 @@ def read_pyproject_toml():
321327
raise FileNotFoundError("No `pyproject.toml` file exists. No dependency will be installed ...")
322328

323329

324-
SetupCfg = namedtuple('SetupCfg', ('setup_requires', 'install_requires', 'tests_requires'))
330+
SetupCfg = namedtuple('SetupCfg', ('setup_requires', 'install_requires', 'tests_requires', 'extras_require'))
325331

326332

327333
def read_setuptools_cfg():
@@ -332,16 +338,10 @@ def read_setuptools_cfg():
332338
from setuptools import Distribution
333339
dist = Distribution()
334340
dist.parse_config_files()
335-
336-
# standard requirements
337-
options_dct = dist.get_option_dict('options')
338-
setup_reqs = options_dct['setup_requires'][1].strip().splitlines()
339-
install_reqs = options_dct['install_requires'][1].strip().splitlines()
340-
tests_reqs = options_dct['tests_require'][1].strip().splitlines()
341-
342-
return SetupCfg(setup_requires=setup_reqs,
343-
install_requires=install_reqs,
344-
tests_requires=tests_reqs)
341+
return SetupCfg(setup_requires=dist.setup_requires,
342+
install_requires=dist.install_requires,
343+
tests_requires=dist.tests_require,
344+
extras_require=dist.extras_require)
345345

346346

347347
def get_req_pkg_name(r):

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
*Separate test code from test cases in `pytest`.*
44

5-
[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-2%20%7C%203%20%7C%204%20%7C%205%20%7C%206-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](./reports/junit/junit-badge.svg?dummy=8484744)](./reports/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases)
5+
[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-2%20%7C%203%20%7C%204%20%7C%205%20%7C%206-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](./reports/junit/junit-badge.svg?dummy=8484744)](./reports/junit/report.html) [![Coverage Status](./reports/coverage/coverage-badge.svg?dummy=8484744)](./reports/coverage/index.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases) [![Flake8 Status](./reports/flake8/flake8-badge.svg?dummy=8484744)](./reports/flake8/index.html)
66

77
[![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-pytest-cases/) [![PyPI](https://img.shields.io/pypi/v/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) [![Downloads](https://pepy.tech/badge/pytest-cases)](https://pepy.tech/project/pytest-cases) [![Downloads per week](https://pepy.tech/badge/pytest-cases/week)](https://pepy.tech/project/pytest-cases) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-pytest-cases.svg)](https://github.com/smarie/python-pytest-cases/stargazers)
88
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3937829.svg)](https://doi.org/10.5281/zenodo.3937829)

docs/long_description.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pytest-cases
22

3-
[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-2%20%7C%203%20%7C%204%20%7C%205%20%7C%206-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](https://smarie.github.io/python-pytest-cases/reports/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases)
3+
[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-2%20%7C%203%20%7C%204%20%7C%205%20%7C%206-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](https://smarie.github.io/python-pytest-cases/reports/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/junit/report.html) [![Coverage Status](https://smarie.github.io/python-pytest-cases/reports/coverage/coverage-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/coverage/index.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases) [![Flake8 Status](https://smarie.github.io/python-pytest-cases/reports/flake8/flake8-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/flake8/index.html)
44

55
[![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-pytest-cases/) [![PyPI](https://img.shields.io/pypi/v/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) [![Downloads](https://pepy.tech/badge/pytest-cases)](https://pepy.tech/project/pytest-cases) [![Downloads per week](https://pepy.tech/badge/pytest-cases/week)](https://pepy.tech/project/pytest-cases) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-pytest-cases.svg)](https://github.com/smarie/python-pytest-cases/stargazers) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3937829.svg)](https://doi.org/10.5281/zenodo.3937829)
66

0 commit comments

Comments
 (0)