Skip to content

Commit f856665

Browse files
Aaron SoellingerAaron Soellinger
authored andcommitted
added new scripts for version checking on travis
1 parent 92cb3a0 commit f856665

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from mplfinance import _version
2+
import argparse
3+
4+
if __name__ == "__main__":
5+
parser = argparse.ArgumentParser(description='Check versions.')
6+
parser.add_argument('--pr', type=str, help='mplfinance.__version__ for the PR')
7+
parser.add_argument('--in', type=str, help='mplfinance.__version__ for the `master` branch')
8+
9+
args = parser.parse_args()
10+
test_tag = 'VersionCheck'
11+
outcome = _version.compare_versions(v_str1=args.pr, v_str2=args.in)
12+
if outcome != '>':
13+
return '0'
14+
15+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Run this script test.sh from project root directory containing setup.py
4+
pr_branch=$1
5+
if ["${pr_branch}" == "false"]:
6+
exit 0
7+
pip3 install .
8+
git checkout ${pr_branch}
9+
pr_version=$(python3 -c "import mplfinance; print(mplfinance.__version__)")
10+
git checkout master
11+
in_version=$(python3 -c "import mplfinance; print(mplfinance.__version__)")
12+
echo "PR: ${pr_version}; Incumbent: ${in_version}"
13+
result=$(python3 -m mplfinance.check_version --pr ${pr_version} --in ${in_version})
14+
tox
15+
if ["${result}" != "VersionCheck:pr>master"]
16+
# version in PR doesn't pass the test
17+
echo "${result}"
18+
exit 1
19+
fi

scripts/check_version.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from mplfinance import _version
2+
import argparse
3+
4+
if __name__ == "__main__":
5+
parser = argparse.ArgumentParser(description='Check versions.')
6+
parser.add_argument('--pr', type=str, help='mplfinance.__version__ for the PR')
7+
parser.add_argument('--in', type=str, help='mplfinance.__version__ for the `master` branch')
8+
9+
args = parser.parse_args()
10+
test_tag = 'VersionCheck:{}'
11+
outcome = _version.compare_versions(v_str1=args.pr, v_str2=args.in)
12+
print(test_tag.format('pr{}master'.format(outcome)))

scripts/test.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
# Run this script test.sh from project root directory containing setup.py
4+
pr_branch=$1
5+
if ["${pr_branch}" == "false"]:
6+
exit 0
7+
pip3 install .
8+
git checkout ${pr_branch}
9+
pr_version=$(python3 -c "import mplfinance; print(mplfinance.__version__)")
10+
git checkout master
11+
in_version=$(python3 -c "import mplfinance; print(mplfinance.__version__)")
12+
echo "PR: ${pr_version}; Incumbent: ${in_version}"
13+
result=$(python3 -m mplfinance.check_version --pr ${pr_version} --in ${in_version})
14+
tox
15+
if ["${result}" != "VersionCheck:pr>master"]
16+
# version in PR doesn't pass the test
17+
echo "${result}"
18+
exit 1
19+
fi

0 commit comments

Comments
 (0)