Skip to content

Commit d5ad1cf

Browse files
authored
[NEW] Py Pkg Gen with better Code Coverage
Release Version '1.12.4' into 'master' Branch
2 parents 04b6624 + a4aa1e1 commit d5ad1cf

File tree

13 files changed

+155
-17
lines changed

13 files changed

+155
-17
lines changed

.github/workflows/load-to-rt.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
board_release_train:
2525
runs-on: ubuntu-latest
2626
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2827
TRAIN: 'release-train'
2928
BOARDING: ${{ github.event.ref == 'refs/tags/auto-release' && 'boarding-auto' || 'boarding' }}
3029
MAIN_BRANCH: 'master'
@@ -110,6 +109,8 @@ jobs:
110109
- name: 'Create PR ${{ env.BOARDING }} --> ${{ env.TRAIN }}'
111110
# --head is the branch where the changes were developed
112111
# --base is the branch you want to merge the changes into
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
113114
run: |
114115
gh pr create --head "${{ env.BOARDING }}" --base "${{ env.TRAIN }}" \
115116
--title "Boarding '${{ steps.user_branch.outputs.USER_BRANCH }}' on Release Train - Merging into ${{ env.TRAIN }} Branch" \
@@ -141,5 +142,6 @@ jobs:
141142
############## Merge ##############
142143
- name: 'Merge PR ${{ env.BOARDING }} --> ${{ env.TRAIN }}'
143144
run: gh pr merge "${{ env.BOARDING }}" --auto --delete-branch --squash
144-
145+
env:
146+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
145147
# HEAD is now at ${{ env.TRAIN }}

.github/workflows/merge-rt-in-release.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ on:
2626
jobs:
2727
# RUN Job when 'boarding-auto --> 'release-train' PR is merged
2828
merge_rt_in_release:
29-
# ALLOWED Head Branches
30-
# if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'boarding-auto')
31-
# if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
32-
if: github.event_name == 'pull_request' && github.event.action == 'closed'
33-
# && github.event.pull_request.head.ref == 'boarding-auto' && github.event.pull_request.merged == true
29+
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'boarding-auto')
3430
# github.event.pull_request.auto_merge_enabled
3531

3632
runs-on: ubuntu-latest

CHANGELOG.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,40 @@ Changelog
33
=========
44

55

6+
1.12.4 (2024-02-09)
7+
===================
8+
9+
**Improved Code Coverage.**
10+
11+
12+
Changes
13+
^^^^^^^
14+
15+
fix
16+
"""
17+
- dynamic runtime loading of all CookiecutterException subclasses from cookiecutter
18+
19+
test
20+
""""
21+
- unit-test *Exception Classifier* and cover all possible returned values
22+
23+
documentation
24+
"""""""""""""
25+
- add docstrings
26+
27+
ci
28+
""
29+
- use pat with Commit, PR, Workflow Trigger in merge-to-rt Workflow
30+
31+
refactor
32+
""""""""
33+
- Exception Classifier more readable code and comment on *critical* / *not-critical* classification decisions
34+
35+
release
36+
"""""""
37+
- bump version to 1.12.4
38+
39+
640
1.12.3 (2024-02-08)
741
===================
842

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ Free/Libre and Open Source Software (FLOSS)
275275

276276
.. Github Releases & Tags
277277
278-
.. |commits_since_specific_tag_on_master| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v1.12.3/master?color=blue&logo=github
278+
.. |commits_since_specific_tag_on_master| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v1.12.4/master?color=blue&logo=github
279279
:alt: GitHub commits since tagged version (branch)
280-
:target: https://github.com/boromir674/cookiecutter-python-package/compare/v1.12.3..master
280+
:target: https://github.com/boromir674/cookiecutter-python-package/compare/v1.12.4..master
281281

282282
.. |commits_since_latest_github_release| image:: https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/latest?color=blue&logo=semver&sort=semver
283283
:alt: GitHub commits since latest release (by SemVer)

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
author = 'Konstantinos Lampridis'
3131

3232
# The full version, including alpha/beta/rc tags
33-
release = '1.12.3'
33+
release = '1.12.4'
3434

3535
# -- General configuration ---------------------------------------------------
3636

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ build-backend = "poetry.core.masonry.api"
1010
## Also renders on pypi as 'subtitle'
1111
[tool.poetry]
1212
name = "cookiecutter_python"
13-
version = "1.12.3"
13+
version = "1.12.4"
1414
description = "1-click Generator of Python Project, from Template with streamlined \"DevOps\" using a powerful CI/CD Pipeline."
1515
authors = ["Konstantinos Lampridis <k.lampridis@hotmail.com>"]
1616
maintainers = ["Konstantinos Lampridis <k.lampridis@hotmail.com>"]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '1.12.3'
1+
__version__ = '1.12.4'
22

33
from . import _logging # noqa

src/cookiecutter_python/backend/hosting_services/exceptions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33

44
class ContextVariableDoesNotExist(Exception):
5+
"""Raised when a Context Variable does not exist, in a dict-like object."""
6+
57
pass

src/cookiecutter_python/backend/post_main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ def post_main(request):
1414

1515

1616
class CheckWebServerError(Exception):
17+
"""Raised on Connection Error, when Requesting a Web Server's Future."""
18+
1719
pass

src/cookiecutter_python/exceptions.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,23 @@
1818

1919

2020
def error_2_str(error):
21-
if isinstance(error, UndefinedVariableInTemplate):
21+
22+
recognized_non_critical = {UndefinedVariableInTemplate}
23+
recognized_critical = set(exceptions['critical']).difference(recognized_non_critical)
24+
25+
## Mark NON Critical for program execution ##
26+
# Program should potentially be able to handle that exception and proceed
27+
if isinstance(error, tuple(recognized_non_critical)):
28+
# We 'mark as non-critical', when we find out-of-scope variables (when a
29+
# template uses a variable which is not defined in the context),
30+
# anticipating the injection of out-of-scope variables programmatically.
2231
return 'non-critical'
2332

24-
if isinstance(error,
25-
tuple(set(exceptions['critical']).difference(set([UndefinedVariableInTemplate])))
26-
):
33+
## Mark CRITICAL for program execution ##
34+
# Program's execution should potentially stop, as unable to handle exception
35+
if isinstance(error, tuple(recognized_critical)):
36+
# We Classify as Critical, all our Generator's backend engine Exceptions
37+
# which are cokiecutter exceptions, but we exclude
38+
# UndefinedVariableInTemplate and we add our Generator's exceptions:
39+
# - ContextVariableDoesNotExist
2740
return 'critical'

0 commit comments

Comments
 (0)