Skip to content

Commit bca37a5

Browse files
authored
Merge pull request #21 from Exabyte-io/feature/SOF-4351
Feature/sof 4351
2 parents 1ac7fe1 + 4504aae commit bca37a5

File tree

5 files changed

+39
-13
lines changed

5 files changed

+39
-13
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
.idea/
1+
*.pyc
2+
.idea
3+
Vagrantfile
4+
.vagrant
5+
htmlcov_*
6+
coverage_*.xml
7+
venv*/
28

39
### See: https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore
410
# Byte-compiled / optimized / DLL files

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
3+
build-backend = "setuptools.build_meta:__legacy__"
4+
5+
[tool.setuptools_scm]
6+
version_scheme = "post-release"
7+
8+
[tool.coverage.run]
9+
source = ['.']
10+
omit = ['env*/*', 'venv*/*', 'tests/*']

requirements-dev.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
certifi==2020.6.20
1+
certifi==2020.12.5
22
chardet==3.0.4
3+
coverage==5.5
34
idna==2.7
4-
mock==1.3.0
5-
pbr==5.5.1
5+
mock==4.0.3
66
requests==2.20.1
7-
six==1.15.0
7+
toml==0.10.2
88
urllib3==1.24.3
99
-e .[test]

run-tests.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ set -e
44
TEST_TYPE="unit"
55
PYTHON_BIN="python3"
66
THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
7+
VENV_NAME="venv"
78

89
usage() {
9-
echo "run-tests.sh -p=PYTHON_BIN -t=TEST_TYPE"
10+
echo "run-tests.sh -p=PYTHON_BIN -v=VENV_NAME -t=TEST_TYPE"
1011
exit 1
1112
}
1213

@@ -19,6 +20,9 @@ check_args() {
1920
-p=* | --python-bin=*)
2021
PYTHON_BIN="${i#*=}"
2122
;;
23+
-v=* | --venvdir=*)
24+
VENV_NAME="${i#*=}"
25+
;;
2226
*)
2327
usage
2428
;;
@@ -29,15 +33,17 @@ check_args() {
2933
check_args $@
3034

3135
# Prepare the execution virtualenv
32-
virtualenv --python ${PYTHON_BIN} ${THIS_DIR}/venv
33-
source ${THIS_DIR}/venv/bin/activate
36+
virtualenv --python ${PYTHON_BIN} ${THIS_DIR}/${VENV_NAME}
37+
source ${THIS_DIR}/${VENV_NAME}/bin/activate
3438
trap "deactivate" EXIT
3539
if [ -f ${THIS_DIR}/requirements-dev.txt ]; then
3640
pip install -r ${THIS_DIR}/requirements-dev.txt --no-deps
3741
fi
3842

3943
# Execute the specified test suite
40-
python -m unittest discover --verbose --catch --start-directory ${THIS_DIR}/tests/${TEST_TYPE}
41-
if [ $? -ne 0 ]; then
42-
exit 1
43-
fi
44+
coverage run -m unittest discover --verbose --catch --start-directory ${THIS_DIR}/tests/${TEST_TYPE}
45+
46+
# Generate the code coverage reports
47+
coverage report
48+
coverage html --directory htmlcov_${TEST_TYPE}
49+
coverage xml -o coverage_${TEST_TYPE}.xml

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
setup(
77
name='exabyte-api-client',
8-
version='2021.01.18.1',
8+
setup_requires=['setuptools_scm'],
9+
use_scm_version={
10+
'version_scheme': 'post-release',
11+
},
912
description='Exabyte Python Client for RESTful API',
1013
long_description=long_description,
1114
long_description_content_type='text/markdown',
@@ -18,6 +21,7 @@
1821
],
1922
extras_require={
2023
"test": [
24+
"coverage[toml]>=5.3",
2125
"mock>=1.3.0",
2226
],
2327
},

0 commit comments

Comments
 (0)