-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INDY-1992] add bump_version.sh script and fix check_version func
Signed-off-by: Andrew Nikitin <andrew.nikitin@dsr-corporation.com>
- Loading branch information
Andrew Nikitin
committed
Mar 1, 2019
1 parent
3f76a6b
commit 3f4b4ed
Showing
3 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
usage_str="Usage: $0 <release-version-dotted>" | ||
|
||
if [ -z "$1" ] ; then | ||
echo $usage_str | ||
exit 0 | ||
fi | ||
|
||
if [ "$1" = "--help" ] ; then | ||
echo $usage_str | ||
exit 0 | ||
fi | ||
|
||
dotted_version=$1 | ||
|
||
import_metadata_str="indy_node.__metadata__" | ||
|
||
# call python set_version function | ||
|
||
python3 -c "from $import_metadata_str import set_version, split_version_from_str | ||
set_version(split_version_from_str(\"$dotted_version\"))" | ||
|
||
ret=$? | ||
if [ $ret -ne 0 ] ; then | ||
echo "FAILED ret: $ret" | ||
exit $ret | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
|
||
from indy_node.__metadata__ import split_version_from_str, check_version | ||
|
||
|
||
def test_split_version_from_str_only_int(): | ||
assert split_version_from_str("1.2.3.4.5") == [1, 2, 3, 4, 5] | ||
|
||
|
||
def test_split_version_from_str_with_str(): | ||
assert split_version_from_str("1.2.3.rc.5") == [1, 2, 3, 'rc', 5] | ||
|
||
|
||
def test_check_version_right_case(): | ||
check_version(split_version_from_str("1.2.3.rc.5")) | ||
|
||
|
||
def test_check_version_wrong_case(): | ||
with pytest.raises(ValueError): | ||
check_version(split_version_from_str("1.2.3.4.5")) |