Commit 3164ee65 authored by Johan Bloemberg's avatar Johan Bloemberg

Fix running without .envrc (eg: gitlab)

parent e6c9c6fb
Pipeline #38240349 failed with stage
in 12 minutes and 10 seconds
......@@ -4,9 +4,8 @@ export DEBUG=1
# during development, just have ipv6 on.
export NETWORK_SUPPORTS_IPV6=1
# record path of Python executable outside of Tox environment to prevent conflicts
# verify required python version is available
export PYTHON_BIN=$(which python3.6)
if test -z "$PYTHON_BIN"; then
echo "Please make sure Python3.6 is installed! https://www.python.org/downloads/"
exit 1
......@@ -16,10 +15,11 @@ fi
# https://pipenv.readthedocs.io/en/latest/install/#virtualenv-mapping-caveat
export VIRTUAL_ENV=$(python -c 'from pipenv.project import Project; print(Project(chdir=False).virtualenv_location)')
# use virtualenv created by Tox for development
# use virtualenv created by Pipenv for development
export PATH=$VIRTUAL_ENV/bin:$PATH
# add tools to path
export PATH=$PWD/tools/:$PATH
# make sure django is loaded correctly during test executions
export DJANGO_SETTINGS_MODULE=failmap.settings
ifeq ($(VIRTUAL_ENV),)
$(info No virtualenv configured, a new virtualenv will be setup)
else
$(info Running in virtualenv: ${VIRTUAL_ENV})
endif
run = pipenv run
all: check test
.PHONY: check
check: | .pipfile_installed
pylama failmap tests setup.py
${run} pylama failmap tests setup.py
.PHONY: autofix
autofix: | .pipfile_installed
# fix trivial pep8 style issues
autopep8 -ri failmap tests setup.py
${run} autopep8 -ri failmap tests setup.py
# remove unused imports
autoflake -ri --remove-all-unused-imports failmap tests setup.py
${run} autoflake -ri --remove-all-unused-imports failmap tests setup.py
# sort imports
isort -rc failmap tests setup.py
${run} isort -rc failmap tests setup.py
# do a check after autofixing to show remaining problems
pylama failmap tests
${run} pylama failmap tests
.PHONY: test
test: check | .pipfile_installed
# run testsuite
coverage run --include 'failmap/*' -m pytest -v -k 'not integration and not system' ${test_args}
${run} coverage run --include 'failmap/*' -m pytest -v -k 'not integration and not system' ${test_args}
# generate coverage
coverage report
${run} coverage report
# and pretty html
coverage html
${run} coverage html
# ensure no model updates are commited without migrations
failmap makemigrations --check
${run} failmap makemigrations --check
.PHONY: datasets
test_datasets: | .pipfile_installed
# find all fixtures in source and verify loading each one
/bin/sh -ec "find failmap -path '*/fixtures/*.yaml' -print0 | \
xargs -0n1 basename -s .yaml | uniq | \
xargs -n1 failmap test_dataset"
xargs -n1 ${run} failmap test_dataset"
.PHONY: integration
test_integration: | .pipfile_installed
nc localhost:redisport || exit 1
DB_NAME=test.sqlite3 pytest -v -k 'integration' ${test_args}
DB_NAME=test.sqlite3 ${run} pytest -v -k 'integration' ${test_args}
.PHONY: system
test_system: | .pipfile_installed
pytest -v tests/system ${test_args}
${run} pytest -v tests/system ${test_args}
# creates virtualenv and installed all Pipfile requirements and the failmap project
pipenv != command -v pipenv || echo pipenv
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment