SHARE
TWEET

Untitled

a guest May 24th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. all: check test
  2.  
  3. VIRTUAL_ENV := $(shell poetry config settings.virtualenvs.path|tr -d \")/websecmap-py3.6
  4. export PATH := ${VIRTUAL_ENV}/bin:${PATH}
  5.  
  6. setup: ${VIRTUAL_ENV}/bin/websecmap
  7.  
  8. ${VIRTUAL_ENV}/bin/websecmap: poetry.lock | ${poetry}
  9.     poetry install --develop=websecmap
  10.     test -f $@ && touch $@
  11.  
  12. test: | setup
  13.     # run testsuite
  14.     DJANGO_SETTINGS_MODULE=websecmap.settings coverage run --include 'websecmap/*' \
  15.         -m pytest -v -k 'not integration and not system' ${testargs}
  16.     # generate coverage
  17.     poetry run coverage report
  18.     # and pretty html
  19.     poetry run coverage html
  20.     # ensure no model updates are commited without migrations
  21.     poetry run websecmap makemigrations --check
  22.  
  23. check: | setup
  24.     pylama websecmap tests --skip "**/migrations/*"
  25.  
  26. autofix fix: | setup
  27.     # fix trivial pep8 style issues
  28.     poetry run autopep8 -ri websecmap tests
  29.     # remove unused imports
  30.     poetry run autoflake -ri --remove-all-unused-imports websecmap tests
  31.     # sort imports
  32.     poetry run isort -rc websecmap tests
  33.     # do a check after autofixing to show remaining problems
  34.     poetry run pylama websecmap tests --skip "**/migrations/*"
  35.  
  36. test_integration: | setup
  37.     DB_NAME=test.sqlite3 pytest -v -k 'integration' ${testargs}
  38.  
  39. test_system:
  40.     pytest -v tests/system ${testargs}
  41.  
  42. test_datasets: | setup
  43.     /bin/sh -ec "find websecmap -path '*/fixtures/*.yaml' -print0 | \
  44.         xargs -0n1 basename -s .yaml | uniq | \
  45.         xargs -n1 websecmap test_dataset"
  46.  
  47. test_deterministic: | ${virtualenv}
  48.     /bin/bash tools/compare_differences.sh HEAD HEAD tools/show_ratings.sh testdata
  49.  
  50. test_mysql:
  51.     docker run --name mysql -d --rm -p 3306:3306 \
  52.         -e MYSQL_ROOT_PASSWORD=failmap \
  53.         -e MYSQL_DATABASE=failmap \
  54.         -e MYSQL_USER=failmap \
  55.         -e MYSQL_PASSWORD=failmap \
  56.         -v $$PWD/tests/etc/mysql-minimal-memory.cnf:/etc/mysql/conf.d/mysql.cnf \
  57.         mysql:5.6
  58.     DJANGO_DATABASE=production DB_USER=root DB_HOST=127.0.0.1 \
  59.         $(MAKE) test; e=$$?; docker stop mysql; exit $$e
  60.  
  61. test_postgres:
  62.     docker run --name postgres -d --rm -p 5432:5432 \
  63.         -e POSTGRES_DB=failmap \
  64.         -e POSTGRES_USER=root \
  65.         -e POSTGRES_PASSWORD=failmap \
  66.         postgres:9.4
  67.     DJANGO_DATABASE=production DB_ENGINE=postgresql_psycopg2 DB_USER=root DB_HOST=127.0.0.1 \
  68.         $(MAKE) test; e=$$?; docker stop postgres; exit $$e
  69.  
  70. clean:
  71.     rm -fr ${VIRTUAL_ENV}/{bin,include,lib,share,*.cfg,*.json}
  72.     test -d ${VIRTUAL_ENV} && rmdir ${VIRTUAL_ENV} || true
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top