From 6d6b5db44fba5e3b48bd515cb32193a3bb0bca2c Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Mon, 21 Oct 2019 09:47:49 +0200 Subject: [PATCH 1/8] Stop using + in versions --- chartpress.py | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/chartpress.py b/chartpress.py index df0fb19..0913855 100755 --- a/chartpress.py +++ b/chartpress.py @@ -204,11 +204,11 @@ def build_images(prefix, images, tag=None, push=False, chart_tag=None, skip_buil Example 1: - long=False: 0.9.0 - - long=True: 0.9.0_000.asdf1234 + - long=True: 0.9.0-000.asdf1234 Example 2: - - long=False: 0.9.0_004.sdfg2345 - - long=True: 0.9.0_004.sdfg2345 + - long=False: 0.9.0-004.sdfg2345 + - long=True: 0.9.0-004.sdfg2345 """ value_modifications = {} for name, options in images.items(): @@ -218,7 +218,7 @@ def build_images(prefix, images, tag=None, push=False, chart_tag=None, skip_buil # similar that influence the image that would be built paths = list(options.get('paths', [])) + [image_path, 'chartpress.yaml'] last_image_commit = last_modified_commit(*paths) - if tag is None: + if image_tag is None: n_commits = int(check_output( [ 'git', 'rev-list', '--count', @@ -233,7 +233,12 @@ def build_images(prefix, images, tag=None, push=False, chart_tag=None, skip_buil ).decode('utf-8').strip()) if n_commits > 0 or long: - image_tag = f"{chart_tag}_{int(n_commits):03d}-{last_image_commit}" + if "-" in chart_tag: + # append a pre-release + image_tag = f"{chart_tag}.{n_commits:03d}-{last_image_commit}" + else: + # append a release + image_tag = f"{chart_tag}-{n_commits:03d}-{last_image_commit}" else: image_tag = f"{chart_tag}" image_name = prefix + name @@ -315,9 +320,11 @@ def build_chart(name, version=None, paths=None, long=False): Example versions constructed: - 0.9.0-alpha.1 - - 0.9.0-alpha.1+000.asdf1234 (--long) - - 0.9.0-alpha.1+005.sdfg2345 - - 0.9.0-alpha.1+005.sdfg2345 (--long) + - 0.9.0-alpha.1.000.asdf123 (--long) + - 0.9.0-alpha.1.005.sdfg234 + - 0.9.0-alpha.1.005.sdfg234 (--long) + - 0.9.0 + - 0.9.0-002.dfgh345 """ chart_file = os.path.join(name, 'Chart.yaml') with open(chart_file) as f: @@ -332,24 +339,30 @@ def build_chart(name, version=None, paths=None, long=False): n_commits = int(n_commits) if n_commits > 0 or long: - version = f"{latest_tag_in_branch}+{n_commits:03d}.{sha}" + if "-" in latest_tag_in_branch: + # append a pre-release + version = f"{latest_tag_in_branch}.{n_commits:03d}.{sha}" + else: + # append a release + version = f"{latest_tag_in_branch}-{n_commits:03d}.{sha}" else: version = f"{latest_tag_in_branch}" except subprocess.CalledProcessError: # no tags on branch: fallback to the SemVer 2 compliant version - # 0.0.1+. + # 0.0.1-. + latest_tag_in_branch = "0.0.1" n_commits = int(check_output( ['git', 'rev-list', '--count', last_chart_commit], echo=False, ).decode('utf-8').strip()) - version = f"0.0.1+{n_commits:03d}.{last_chart_commit}" + version = f"{latest_tag_in_branch}-{n_commits:03d}.{last_chart_commit}" chart['version'] = version with open(chart_file, 'w') as f: yaml.dump(chart, f) - return version + return latest_tag_in_branch, version def publish_pages(chart_name, chart_version, chart_repo_github_path, chart_repo_url, extra_message=''): @@ -501,7 +514,7 @@ def main(): chart_version = chart_version.lstrip('v') if args.reset: chart_version = chart.get('resetVersion', '0.0.1-set.by.chartpress') - chart_version = build_chart(chart['name'], paths=chart_paths, version=chart_version, long=args.long) + chart_tag, chart_version = build_chart(chart['name'], paths=chart_paths, version=chart_version, long=args.long) if 'images' in chart: image_prefix = args.image_prefix if args.image_prefix is not None else chart['imagePrefix'] @@ -510,10 +523,7 @@ def main(): images=chart['images'], tag=args.tag if not args.reset else chart.get('resetTag', 'set-by-chartpress'), push=args.push, - # chart_tag will act as a image tag prefix, we can get it from - # the chart_version by stripping away the build part of the - # SemVer 2 compliant chart_version. - chart_tag=chart_version.split('+')[0], + chart_tag=chart_tag, skip_build=args.skip_build or args.reset, long=args.long, ) From 7927c9307693909b60752fa224cde10965b7bac0 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Mon, 21 Oct 2019 09:57:51 +0200 Subject: [PATCH 2/8] Fix image tag bug: use of - instead of . --- chartpress.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chartpress.py b/chartpress.py index 0913855..07acdf2 100755 --- a/chartpress.py +++ b/chartpress.py @@ -235,10 +235,10 @@ def build_images(prefix, images, tag=None, push=False, chart_tag=None, skip_buil if n_commits > 0 or long: if "-" in chart_tag: # append a pre-release - image_tag = f"{chart_tag}.{n_commits:03d}-{last_image_commit}" + image_tag = f"{chart_tag}.{n_commits:03d}.{last_image_commit}" else: # append a release - image_tag = f"{chart_tag}-{n_commits:03d}-{last_image_commit}" + image_tag = f"{chart_tag}-{n_commits:03d}.{last_image_commit}" else: image_tag = f"{chart_tag}" image_name = prefix + name From a41cb4dc4e116d28fadec918475501350ff2a359 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Mon, 21 Oct 2019 10:08:13 +0200 Subject: [PATCH 3/8] Strip added g prefix part of git describe's returned sha --- chartpress.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chartpress.py b/chartpress.py index 07acdf2..2a2165d 100755 --- a/chartpress.py +++ b/chartpress.py @@ -336,6 +336,9 @@ def build_chart(name, version=None, paths=None, long=False): try: git_describe = check_output(['git', 'describe', '--tags', '--long', last_chart_commit]).decode('utf8').strip() latest_tag_in_branch, n_commits, sha = git_describe.rsplit('-', maxsplit=2) + # remove the "g" prefix that is part of the git describe command + # ref: https://git-scm.com/docs/git-describe#_examples + sha = sha[1:] n_commits = int(n_commits) if n_commits > 0 or long: From af36ad7645f6b8ad6c30b0b4fe2cc6700ed6ea5c Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Mon, 21 Oct 2019 13:45:00 +0200 Subject: [PATCH 4/8] Fix initial implementation --- chartpress.py | 101 +++++++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 46 deletions(-) diff --git a/chartpress.py b/chartpress.py index 2a2165d..e7e428b 100755 --- a/chartpress.py +++ b/chartpress.py @@ -10,6 +10,7 @@ from functools import lru_cache, partial import os import pipes +import re import shutil import subprocess from tempfile import TemporaryDirectory @@ -179,7 +180,32 @@ def image_needs_building(image): return image_needs_pushing(image) -def build_images(prefix, images, tag=None, push=False, chart_tag=None, skip_build=False, long=False): +def _get_identifier(tag, n_commits, commit, long): + n_commits = int(n_commits) + + if n_commits > 0 or long: + if "-" in tag: + # append a pre-release + return f"{tag}.{n_commits:03d}.{commit}" + else: + # append a release + return f"{tag}-{n_commits:03d}.{commit}" + else: + return f"{tag}" + + +def _strip_identifiers_build_suffix(identifier): + # split away official SemVer 2 build specifications if used + if "+" in identifier: + return identifier.split("+", maxsplit=1)[0] + + # split away our custom build specification: something ending in either + # . or - followed by three or more digits, a dot, an commit sha of four + # or more alphanumeric characters. + return re.sub(r'[-\.]\d{3,}\.\w{4,}\Z', "", identifier) + + +def build_images(prefix, images, tag=None, push=False, chart_version=None, skip_build=False, long=False): """Build a collection of docker images Args: @@ -191,9 +217,9 @@ def build_images(prefix, images, tag=None, push=False, chart_tag=None, skip_buil to modify the image's files. push (bool): Whether to push the resulting images (default: False). - chart_tag (str): - The latest chart tag, included as a prefix on image tags - if `tag` is not specified. + chart_version (str): + The latest chart version, trimmed from its build suffix, will be included + as a prefix on image tags if `tag` is not specified. skip_build (bool): Whether to skip the actual image build (only updates tags). long (bool): @@ -214,33 +240,25 @@ def build_images(prefix, images, tag=None, push=False, chart_tag=None, skip_buil for name, options in images.items(): image_path = options.get('contextPath', os.path.join('images', name)) image_tag = tag + chart_version = _strip_identifiers_build_suffix(chart_version) # include chartpress.yaml itself as it can contain build args and # similar that influence the image that would be built paths = list(options.get('paths', [])) + [image_path, 'chartpress.yaml'] - last_image_commit = last_modified_commit(*paths) + latest_image_modification_commit = last_modified_commit(*paths) if image_tag is None: - n_commits = int(check_output( + n_commits = check_output( [ 'git', 'rev-list', '--count', - # Note that the 0.0.1 chart_tag may not exist as it was a + # Note that the 0.0.1 chart_version may not exist as it was a # workaround to handle git histories with no tags in the - # current branch. Also, if the chart_tag is a later git - # reference than the last_image_commit, this command will - # return 0. - f'{chart_tag + ".." if chart_tag != "0.0.1" else ""}{last_image_commit}', + # current branch. Also, if the chart_version is a later git + # reference than the latest_image_modification_commit, this + # command will return 0. + f'{"" if chart_version == "0.0.1" else chart_version + ".."}{latest_image_modification_commit}', ], echo=False, - ).decode('utf-8').strip()) - - if n_commits > 0 or long: - if "-" in chart_tag: - # append a pre-release - image_tag = f"{chart_tag}.{n_commits:03d}.{last_image_commit}" - else: - # append a release - image_tag = f"{chart_tag}-{n_commits:03d}.{last_image_commit}" - else: - image_tag = f"{chart_tag}" + ).decode('utf-8').strip() + image_tag = _get_identifier(chart_version, n_commits, latest_image_modification_commit, long) image_name = prefix + name image_spec = '{}:{}'.format(image_name, image_tag) @@ -256,7 +274,7 @@ def build_images(prefix, images, tag=None, push=False, chart_tag=None, skip_buil build_args = render_build_args( options, { - 'LAST_COMMIT': last_image_commit, + 'LAST_COMMIT': latest_image_modification_commit, 'TAG': image_tag, }, ) @@ -320,52 +338,43 @@ def build_chart(name, version=None, paths=None, long=False): Example versions constructed: - 0.9.0-alpha.1 - - 0.9.0-alpha.1.000.asdf123 (--long) - - 0.9.0-alpha.1.005.sdfg234 - - 0.9.0-alpha.1.005.sdfg234 (--long) + - 0.9.0-alpha.1.000.asdf1234 (--long) + - 0.9.0-alpha.1.005.sdfg2345 + - 0.9.0-alpha.1.005.sdfg2345 (--long) - 0.9.0 - - 0.9.0-002.dfgh345 + - 0.9.0-002.dfgh3456 """ chart_file = os.path.join(name, 'Chart.yaml') with open(chart_file) as f: chart = yaml.load(f) - last_chart_commit = last_modified_commit(*paths) - if version is None: + last_chart_commit = last_modified_commit(*paths) + try: + print(last_chart_commit) git_describe = check_output(['git', 'describe', '--tags', '--long', last_chart_commit]).decode('utf8').strip() latest_tag_in_branch, n_commits, sha = git_describe.rsplit('-', maxsplit=2) - # remove the "g" prefix that is part of the git describe command + # remove "g" prefix output by the git describe command # ref: https://git-scm.com/docs/git-describe#_examples sha = sha[1:] - - n_commits = int(n_commits) - if n_commits > 0 or long: - if "-" in latest_tag_in_branch: - # append a pre-release - version = f"{latest_tag_in_branch}.{n_commits:03d}.{sha}" - else: - # append a release - version = f"{latest_tag_in_branch}-{n_commits:03d}.{sha}" - else: - version = f"{latest_tag_in_branch}" + version = _get_identifier(latest_tag_in_branch, n_commits, sha, long) except subprocess.CalledProcessError: # no tags on branch: fallback to the SemVer 2 compliant version # 0.0.1-. latest_tag_in_branch = "0.0.1" n_commits = int(check_output( ['git', 'rev-list', '--count', last_chart_commit], - echo=False, ).decode('utf-8').strip()) - version = f"{latest_tag_in_branch}-{n_commits:03d}.{last_chart_commit}" + + version = _get_identifier(latest_tag_in_branch, n_commits, last_chart_commit, long) chart['version'] = version with open(chart_file, 'w') as f: yaml.dump(chart, f) - return latest_tag_in_branch, version + return version def publish_pages(chart_name, chart_version, chart_repo_github_path, chart_repo_url, extra_message=''): @@ -517,7 +526,7 @@ def main(): chart_version = chart_version.lstrip('v') if args.reset: chart_version = chart.get('resetVersion', '0.0.1-set.by.chartpress') - chart_tag, chart_version = build_chart(chart['name'], paths=chart_paths, version=chart_version, long=args.long) + chart_version = build_chart(chart['name'], paths=chart_paths, version=chart_version, long=args.long) if 'images' in chart: image_prefix = args.image_prefix if args.image_prefix is not None else chart['imagePrefix'] @@ -526,7 +535,7 @@ def main(): images=chart['images'], tag=args.tag if not args.reset else chart.get('resetTag', 'set-by-chartpress'), push=args.push, - chart_tag=chart_tag, + chart_version=chart_version, skip_build=args.skip_build or args.reset, long=args.long, ) From f41990ce028a9b67b290a83dd4133db7a6832d20 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Mon, 21 Oct 2019 15:08:08 +0200 Subject: [PATCH 5/8] Manage tags after modification commits We failed to update the chart version or image tag if there was a git tag more recent that the latest modifying commit. This commit fixes that. --- chartpress.py | 87 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 35 deletions(-) diff --git a/chartpress.py b/chartpress.py index e7e428b..8e25264 100755 --- a/chartpress.py +++ b/chartpress.py @@ -56,29 +56,39 @@ def git_remote(git_repo): return 'git@github.com:{0}'.format(git_repo) -def last_modified_commit(*paths, **kwargs): +def latest_tag_or_mod_commit(*paths, **kwargs): """Get the last commit to modify the given paths""" - return check_output([ - 'git', - 'log', - '-n', '1', - '--pretty=format:%h', - '--', - *paths - ], **kwargs).decode('utf-8').strip() - - -def last_modified_date(*paths, **kwargs): - """Return the last modified date (as a string) for the given paths""" - return check_output([ - 'git', - 'log', - '-n', '1', - '--pretty=format:%cd', - '--date=iso', - '--', - *paths - ], **kwargs).decode('utf-8').strip() + latest_modification_commit = check_output( + [ + 'git', 'log', + '--max-count=1', + '--pretty=format:%h', + '--', + *paths, + ], + **kwargs, + ).decode('utf-8').strip() + + git_describe_head = check_output( + [ + 'git', 'describe', '--tags', '--long' + ], + **kwargs, + ).decode('utf-8').strip().rsplit("-", maxsplit=2) + latest_tagged_commit = git_describe_head[2][1:] + + try: + check_call( + [ + 'git', 'merge-base', '--is-ancestor', latest_tagged_commit, latest_modification_commit, + ], + **kwargs, + ) + except subprocess.CalledProcessError: + # latest_tagged_commit was newer than latest_modification_commit + return latest_tagged_commit + else: + return latest_modification_commit def render_build_args(image_options, ns): @@ -244,7 +254,7 @@ def build_images(prefix, images, tag=None, push=False, chart_version=None, skip_ # include chartpress.yaml itself as it can contain build args and # similar that influence the image that would be built paths = list(options.get('paths', [])) + [image_path, 'chartpress.yaml'] - latest_image_modification_commit = last_modified_commit(*paths) + image_commit = latest_tag_or_mod_commit(*paths, echo=False) if image_tag is None: n_commits = check_output( [ @@ -252,13 +262,13 @@ def build_images(prefix, images, tag=None, push=False, chart_version=None, skip_ # Note that the 0.0.1 chart_version may not exist as it was a # workaround to handle git histories with no tags in the # current branch. Also, if the chart_version is a later git - # reference than the latest_image_modification_commit, this + # reference than the image_commit, this # command will return 0. - f'{"" if chart_version == "0.0.1" else chart_version + ".."}{latest_image_modification_commit}', + f'{"" if chart_version == "0.0.1" else chart_version + ".."}{image_commit}', ], echo=False, ).decode('utf-8').strip() - image_tag = _get_identifier(chart_version, n_commits, latest_image_modification_commit, long) + image_tag = _get_identifier(chart_version, n_commits, image_commit, long) image_name = prefix + name image_spec = '{}:{}'.format(image_name, image_tag) @@ -274,7 +284,7 @@ def build_images(prefix, images, tag=None, push=False, chart_version=None, skip_ build_args = render_build_args( options, { - 'LAST_COMMIT': latest_image_modification_commit, + 'LAST_COMMIT': image_commit, 'TAG': image_tag, }, ) @@ -349,11 +359,15 @@ def build_chart(name, version=None, paths=None, long=False): chart = yaml.load(f) if version is None: - last_chart_commit = last_modified_commit(*paths) + chart_commit = latest_tag_or_mod_commit(*paths, echo=False) try: - print(last_chart_commit) - git_describe = check_output(['git', 'describe', '--tags', '--long', last_chart_commit]).decode('utf8').strip() + git_describe = check_output( + [ + 'git', 'describe', '--tags', '--long', chart_commit + ], + echo=False, + ).decode('utf8').strip() latest_tag_in_branch, n_commits, sha = git_describe.rsplit('-', maxsplit=2) # remove "g" prefix output by the git describe command # ref: https://git-scm.com/docs/git-describe#_examples @@ -361,13 +375,16 @@ def build_chart(name, version=None, paths=None, long=False): version = _get_identifier(latest_tag_in_branch, n_commits, sha, long) except subprocess.CalledProcessError: # no tags on branch: fallback to the SemVer 2 compliant version - # 0.0.1-. + # 0.0.1-. latest_tag_in_branch = "0.0.1" - n_commits = int(check_output( - ['git', 'rev-list', '--count', last_chart_commit], - ).decode('utf-8').strip()) + n_commits = check_output( + [ + 'git', 'rev-list', '--count', chart_commit + ], + echo=False, + ).decode('utf-8').strip() - version = _get_identifier(latest_tag_in_branch, n_commits, last_chart_commit, long) + version = _get_identifier(latest_tag_in_branch, n_commits, chart_commit, long) chart['version'] = version From a01d94dafcdf17a0e0c6fa5a78bf6c4e61795aca Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Mon, 21 Oct 2019 17:47:40 +0200 Subject: [PATCH 6/8] Add and update related docstrings --- chartpress.py | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/chartpress.py b/chartpress.py index 8e25264..1685946 100755 --- a/chartpress.py +++ b/chartpress.py @@ -57,7 +57,10 @@ def git_remote(git_repo): def latest_tag_or_mod_commit(*paths, **kwargs): - """Get the last commit to modify the given paths""" + """ + Get the latest of a) the latest tagged commit, or b) the latest modification + commit to provided path. + """ latest_modification_commit = check_output( [ 'git', 'log', @@ -191,20 +194,43 @@ def image_needs_building(image): def _get_identifier(tag, n_commits, commit, long): + """ + Returns a chartpress formatted chart version or image tag (identifier) with + a build suffix. + + This function should provide valid Helm chart versions, which means they + need to be valid SemVer 2 version strings. It also needs to return valid + image tags, which means they need to not contain `+` signs either. + + Example: + tag="0.1.2", n_commits="5", commit="asdf1234", long=True, + should return "0.1.2-005.asdf1234". + """ n_commits = int(n_commits) if n_commits > 0 or long: if "-" in tag: - # append a pre-release + # append a pre-release tag, with a . separator + # 0.1.2-alpha.1 -> 0.1.2-alpha.1.n.sha return f"{tag}.{n_commits:03d}.{commit}" else: - # append a release + # append a release tag, with a - separator + # 0.1.2 -> 0.1.2-n.sha return f"{tag}-{n_commits:03d}.{commit}" else: return f"{tag}" def _strip_identifiers_build_suffix(identifier): + """ + Return a stripped chart version or image tag (identifier) without its build + suffix (.005.asdf1234), leaving it to represent a Semver 2 release or + pre-release. + + Example: + identifier: "0.1.2-005.asdf1234" returns: "0.1.2" + identifier: "0.1.2-alpha.1.005.asdf1234" returns: "0.1.2-alpha.1" + """ # split away official SemVer 2 build specifications if used if "+" in identifier: return identifier.split("+", maxsplit=1)[0] From 8b2451cc9fc8c7c7baaace6cb042725212e41f13 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Mon, 21 Oct 2019 21:14:40 +0200 Subject: [PATCH 7/8] Add tests --- .travis.yml | 3 ++- README.md | 16 ++++++++++++++++ tests/__init__.py | 0 tests/test_regexp.py | 14 ++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/__init__.py create mode 100644 tests/test_regexp.py diff --git a/.travis.yml b/.travis.yml index a47cf03..998bf51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,12 @@ cache: pip install: - set -e - pip install --upgrade pip - - pip install pyflakes . + - pip install pyflakes pytest . script: - chartpress --version - chartpress --help - pyflakes . + - pytest -v ./tests # This is a workaround to an issue caused by the existence of a docker # registrymirror in our CI environment. Without this fix that removes the diff --git a/README.md b/README.md index 7dbf6a9..6caa976 100644 --- a/README.md +++ b/README.md @@ -157,3 +157,19 @@ in your `.travis.yml`: git: depth: false ``` + +## Development + +Testing of this python package can be done using [`pyflakes`](https://github.com/PyCQA/pyflakes) and [`pytest`](https://github.com/pytest-dev/pytest). There is also some additional testing that is only run as part of TravisCI, as declared in [`.travis.yml`](.travis.yml). + +``` +# install chartpress locally +pip install -e . + +# install dev dependencies +pip install pyflakes pytest + +# run tests +pyflakes . +pytest -v +``` diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_regexp.py b/tests/test_regexp.py new file mode 100644 index 0000000..b597655 --- /dev/null +++ b/tests/test_regexp.py @@ -0,0 +1,14 @@ +from chartpress import _strip_identifiers_build_suffix +from chartpress import _get_identifier + +def test__strip_identifiers_build_suffix(): + assert _strip_identifiers_build_suffix(identifier="0.1.2-005.asdf1234") == "0.1.2" + assert _strip_identifiers_build_suffix(identifier="0.1.2-alpha.1.005.asdf1234") == "0.1.2-alpha.1" + +def test__get_identifier(): + assert _get_identifier(tag="0.1.2", n_commits="0", commit="asdf123", long=True) == "0.1.2-000.asdf123" + assert _get_identifier(tag="0.1.2", n_commits="0", commit="asdf123", long=False) == "0.1.2" + assert _get_identifier(tag="0.1.2", n_commits="5", commit="asdf123", long=False) == "0.1.2-005.asdf123" + assert _get_identifier(tag="0.1.2-alpha.1", n_commits="0", commit="asdf1234", long=True) == "0.1.2-alpha.1.000.asdf1234" + assert _get_identifier(tag="0.1.2-alpha.1", n_commits="0", commit="asdf1234", long=False) == "0.1.2-alpha.1" + assert _get_identifier(tag="0.1.2-alpha.1", n_commits="5", commit="asdf1234", long=False) == "0.1.2-alpha.1.005.asdf1234" From a34aaea2fb395b5e668b0a3524323c2a33b475f6 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 22 Oct 2019 09:05:02 +0200 Subject: [PATCH 8/8] no need for __init__ in test directory --- tests/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/__init__.py diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000