mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-14 21:22:48 +01:00
add yaml helper script; refactor python testing
This commit is contained in:
@@ -3,23 +3,6 @@
|
||||
COMMAND=$1
|
||||
SENSORONI_CONTAINER=${SENSORONI_CONTAINER:-so-sensoroni}
|
||||
|
||||
function ci() {
|
||||
HOME_DIR=$(dirname "$0")
|
||||
TARGET_DIR=${1:-.}
|
||||
|
||||
PATH=$PATH:/usr/local/bin
|
||||
|
||||
if ! which pytest &> /dev/null || ! which flake8 &> /dev/null ; then
|
||||
echo "Missing dependencies. Consider running the following command:"
|
||||
echo " python -m pip install flake8 pytest pytest-cov"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pip install pytest pytest-cov
|
||||
flake8 "$TARGET_DIR" "--config=${HOME_DIR}/pytest.ini"
|
||||
python3 -m pytest "--cov-config=${HOME_DIR}/pytest.ini" "--cov=$TARGET_DIR" --doctest-modules --cov-report=term --cov-fail-under=100 "$TARGET_DIR"
|
||||
}
|
||||
|
||||
function download() {
|
||||
ANALYZERS=$1
|
||||
if [[ $ANALYZERS = "all" ]]; then
|
||||
@@ -36,5 +19,5 @@ function download() {
|
||||
if [[ "$COMMAND" == "download" ]]; then
|
||||
download "$2"
|
||||
else
|
||||
ci
|
||||
../../../../pyci.sh $@
|
||||
fi
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
[flake8]
|
||||
exclude =
|
||||
.venv
|
||||
*/site-packages/,
|
||||
*/source-packages/,
|
||||
*/__pycache__
|
||||
show_source = true
|
||||
max_complexity = 12
|
||||
max_line_length = 200
|
||||
statistics = true
|
||||
doctests = true
|
||||
|
||||
[pytest]
|
||||
python_files = *_test.py
|
||||
python_classes = Test
|
||||
python_functions = test_*
|
||||
norecursedirs = site-packages
|
||||
|
||||
[report]
|
||||
exclude_lines =
|
||||
if __name__ == .__main__.:
|
||||
|
||||
show_missing = True
|
||||
omit =
|
||||
*_test.py,
|
||||
*/site-packages/*,
|
||||
*/source-packages/*
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user