aboutsummaryrefslogtreecommitdiff
path: root/run_tests.sh
diff options
context:
space:
mode:
authorPhilip Paquette <pcpaquette@gmail.com>2018-09-26 13:35:26 -0400
committerPhilip Paquette <pcpaquette@gmail.com>2019-04-18 11:14:56 -0400
commit7db5011d67a98c05e69d29c5f2ff31314a82bde4 (patch)
treed0d2c7e16db9e44fe636e701de0b3947fc3b2c91 /run_tests.sh
parent6187faf20384b0c5a4966343b2d4ca47f8b11e45 (diff)
Fixed import path, requirements, and MANIFEST
- Added numpy as a requirement (for zobrist hashing) - Added tests files - Added MANIFEST.in
Diffstat (limited to 'run_tests.sh')
-rwxr-xr-xrun_tests.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/run_tests.sh b/run_tests.sh
new file mode 100755
index 0000000..9606844
--- /dev/null
+++ b/run_tests.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+# Syntax: ./run_tests -- Run tests in parallel across CPUs
+# ./run_tests <nb_cores> -- Run tests in parallel across this number of CPUs
+# ./run_tests 0 -- Only runs the pylint tests
+export PYTHONIOENCODING=utf-8
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+FAILED=0
+
+# Running pytest
+if [ "${1:-auto}" != "0" ]; then
+ pytest -v --forked -n "${1:-auto}" || FAILED=1
+fi
+
+# Running pylint
+find diplomacy -name "*.py" ! -name 'zzz_*.py' ! -name '_*.py' -exec pylint '{}' + && \
+
+# Running eslint
+if [ -f "$DIR/diplomacy/web/node_modules/.bin/eslint" ]; then
+ if [ -z ${NVM_DIR+x} ]; then
+ export NVM_DIR="$HOME/.nvm"
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
+ [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
+ fi
+ cd $DIR/diplomacy/web/
+ node_modules/.bin/eslint --ext js,jsx . || FAILED=1
+ npm run build || FAILED=1
+ cd -
+else
+ echo "Skipping ESLint. Make sure NVM and NodeJS are installed first."
+fi
+
+# Exiting
+if [[ "$FAILED" -eq 1 ]]; then
+ echo "*** TESTS FAILED ***"
+ exit 1
+else
+ echo "All tests passed."
+ exit 0
+fi