Merge pull request #1864 from alphagov/pytest-env

Automatically set environment vars before tests
This commit is contained in:
Leo Hemsted
2018-02-14 15:11:53 +00:00
committed by GitHub
4 changed files with 12 additions and 12 deletions
-8
View File
@@ -1,8 +0,0 @@
export NOTIFY_ENVIRONMENT='test'
export ADMIN_CLIENT_SECRET='dev-notify-secret-key'
export API_HOST_NAME=''
export DANGEROUS_SALT='dev-notify-salt'
export SECRET_KEY='dev-notify-secret-key'
export DESKPRO_API_HOST=""
export DESKPRO_API_KEY=""
export STATSD_PREFIX="stats-prefix"
+11
View File
@@ -0,0 +1,11 @@
[pytest]
testpaths = tests
env =
NOTIFY_ENVIRONMENT=test
ADMIN_CLIENT_SECRET=dev-notify-secret-key
API_HOST_NAME=test
DANGEROUS_SALT=dev-notify-salt
SECRET_KEY=dev-notify-secret-key
DESKPRO_API_HOST=test
DESKPRO_API_KEY=test
STATSD_PREFIX=stats-prefix
+1
View File
@@ -1,5 +1,6 @@
-r requirements.txt -r requirements.txt
pytest==3.4.0 pytest==3.4.0
pytest-env==0.6.2
pytest-mock==1.6.3 pytest-mock==1.6.3
pytest-cov==2.5.1 pytest-cov==2.5.1
pytest-xdist==1.22.0 pytest-xdist==1.22.0
-4
View File
@@ -5,12 +5,8 @@
# NOTE: This script expects to be run from the project root with # NOTE: This script expects to be run from the project root with
# ./scripts/run_tests.sh # ./scripts/run_tests.sh
# Use default environment vars for localhost if not already set
set -o pipefail set -o pipefail
source environment_test.sh
function display_result { function display_result {
RESULT=$1 RESULT=$1
EXIT_STATUS=$2 EXIT_STATUS=$2