Change to use tox to manage unit tests

This commit is contained in:
Basraah 2017-09-25 17:25:28 +10:00
parent d93f36a180
commit 280ddb336e
6 changed files with 74 additions and 152 deletions

View File

@ -1,27 +1,24 @@
language: python language: python
python: sudo: false
- "3.5" cache: pip
- "3.6" dist: trusty
- "3.7-dev"
# command to install dependencies
install: install:
- pip install requests - pip install coveralls>=1.1 tox
- pip install Django==$DJANGO_VERSION
- pip install -r requirements.txt
- pip install -r testing-requirements.txt
# command to run tests # command to run tests
script: script:
- django-admin version - tox
- coverage run runtests.py
cache: pip
after_success: after_success:
coveralls coveralls
matrix: matrix:
include:
- env: TOXENV=py35-dj111
python: '3.5'
- env: TOXENV=py36-dj111
python: '3.6'
- env: TOXENV=py37-dj111
python: '3.7-dev'
- env: TOXENV=py36-dj20
python: '3.6'
allow_failures: allow_failures:
- python: "3.7-dev" - env: TOXENV=py37-dj111
- env: DJANGO_VERSION=2.0a1 - env: TOXENV=py36-dj20
env:
- DJANGO_VERSION=1.10.8 # Remove in December 2017
- DJANGO_VERSION=1.11.5
- DJANGO_VERSION=2.0a1
# Add 2.0 when available and allow_failures (env: KEY=VALUE)

View File

@ -1,28 +0,0 @@
# Python dependencies
# Any changes in these package requirements
# should be reflected in setup.py as well.
mysqlclient
dnspython
passlib
requests>=2.9.1
bcrypt
python-slugify>=1.2
requests-oauthlib
redis
celery>=4.0.2
# Django Stuff #
django>=1.10
django-bootstrap-form
django-bootstrap-pagination
django-registration
django-sortedm2m
django-redis-cache>=1.7.1
django-celery-beat
# Openfire
sleekxmpp
openfire-restapi
adarnauth-esi>=1.4,<2.0

View File

@ -2,16 +2,7 @@
from setuptools import setup from setuptools import setup
import allianceauth import allianceauth
install_requires = [
setup(
name='allianceauth',
version=allianceauth.__version__,
author='Alliance Auth',
author_email='adarnof@gmail.com',
description='Eve alliance auth for the 99 percent',
# Any changes in these package requirements
# should be reflected in requirements.txt as well.
install_requires=[
'mysqlclient', 'mysqlclient',
'dnspython', 'dnspython',
'passlib', 'passlib',
@ -23,7 +14,7 @@ setup(
'redis', 'redis',
'celery>=4.0.2', 'celery>=4.0.2',
'django>=1.10,<2.0', 'django>=1.11',
'django-bootstrap-form', 'django-bootstrap-form',
'django-bootstrap-pagination', 'django-bootstrap-pagination',
'django-registration', 'django-registration',
@ -36,7 +27,26 @@ setup(
'sleekxmpp', 'sleekxmpp',
'adarnauth-esi>=1.4,<2.0', 'adarnauth-esi>=1.4,<2.0',
], ]
testing_extras = [
'coverage>=4.3.1',
'requests-mock>=1.2.0',
'django-nose',
]
setup(
name='allianceauth',
version=allianceauth.__version__,
author='Alliance Auth',
author_email='adarnof@gmail.com',
description='Eve alliance auth for the 99 percent',
# Any changes in these package requirements
# should be reflected in requirements.txt as well.
install_requires=install_requires,
extras_require={
'testing': testing_extras,
},
license='GPLv2', license='GPLv2',
packages=['allianceauth'], packages=['allianceauth'],
url='https://github.com/allianceauth/allianceauth', url='https://github.com/allianceauth/allianceauth',

View File

@ -25,7 +25,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(alliance_auth.__file_
SECRET_KEY = 'testing only' SECRET_KEY = 'testing only'
DEBUG = True DEBUG = False
# Application definition # Application definition
@ -160,7 +160,7 @@ MESSAGE_TAGS = {
CACHES = { CACHES = {
'default': { 'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache', 'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
} }
} }
@ -172,15 +172,6 @@ AUTHENTICATION_BACKENDS = ['allianceauth.authentication.backends.StateBackend',
## ##
##################################################### #####################################################
###########################
# ALLIANCE / CORP TOGGLE
###########################
# Specifies to run membership checks against corp or alliance
# Set to FALSE for alliance
# Set to TRUE for corp
###########################
IS_CORP = 'True' == os.environ.get('AA_IS_CORP', 'True')
################# #################
# EMAIL SETTINGS # EMAIL SETTINGS
################# #################
@ -192,27 +183,13 @@ IS_CORP = 'True' == os.environ.get('AA_IS_CORP', 'True')
# EMAIL_USE_TLS - Set to use TLS encryption # EMAIL_USE_TLS - Set to use TLS encryption
################# #################
DOMAIN = os.environ.get('AA_DOMAIN', 'https://example.com') DOMAIN = os.environ.get('AA_DOMAIN', 'https://example.com')
SITE_NAME = os.environ.get('AA_SITE_NAME', 'Test Alliance Auth')
EMAIL_HOST = os.environ.get('AA_EMAIL_HOST', 'smtp.example.com') EMAIL_HOST = os.environ.get('AA_EMAIL_HOST', 'smtp.example.com')
EMAIL_PORT = int(os.environ.get('AA_EMAIL_PORT', '587')) EMAIL_PORT = int(os.environ.get('AA_EMAIL_PORT', '587'))
EMAIL_HOST_USER = os.environ.get('AA_EMAIL_HOST_USER', '') EMAIL_HOST_USER = os.environ.get('AA_EMAIL_HOST_USER', '')
EMAIL_HOST_PASSWORD = os.environ.get('AA_EMAIL_HOST_PASSWORD', '') EMAIL_HOST_PASSWORD = os.environ.get('AA_EMAIL_HOST_PASSWORD', '')
EMAIL_USE_TLS = 'True' == os.environ.get('AA_EMAIL_USE_TLS', 'True') EMAIL_USE_TLS = 'True' == os.environ.get('AA_EMAIL_USE_TLS', 'True')
####################
# Front Page Links
####################
# KILLBOARD_URL - URL for your killboard. Blank to hide link
# MEDIA_URL - URL for your media page (youtube etc). Blank to hide link
# FORUM_URL - URL for your forums. Blank to hide link
# SITE_NAME - Name of the auth site.
####################
KILLBOARD_URL = os.environ.get('AA_KILLBOARD_URL', '')
EXTERNAL_MEDIA_URL = os.environ.get('AA_EXTERNAL_MEDIA_URL', '')
FORUM_URL = os.environ.get('AA_FORUM_URL', '')
SITE_NAME = os.environ.get('AA_SITE_NAME', 'Test Alliance Auth')
PHPBB3_URL = FORUM_URL
################### ###################
# SSO Settings # SSO Settings
################### ###################
@ -226,49 +203,6 @@ ESI_SSO_CLIENT_ID = os.environ.get('AA_ESI_SSO_CLIENT_ID', '')
ESI_SSO_CLIENT_SECRET = os.environ.get('AA_ESI_SSO_CLIENT_SECRET', '') ESI_SSO_CLIENT_SECRET = os.environ.get('AA_ESI_SSO_CLIENT_SECRET', '')
ESI_SSO_CALLBACK_URL = os.environ.get('AA_ESI_SSO_CALLBACK_URL', '') ESI_SSO_CALLBACK_URL = os.environ.get('AA_ESI_SSO_CALLBACK_URL', '')
#########################
# Corp Configuration
#########################
# If running in alliance mode, the following should be for the executor corp#
# CORP_ID - Set this to your corp ID (get this from https://zkillboard.com/corporation/#######)
# CORP_NAME - Set this to your Corporation Name
# CORP_API_ID - Set this to the api id for the corp API key
# CORP_API_VCODE - Set this to the api vcode for the corp API key
########################
CORP_ID = os.environ.get('AA_CORP_ID', '1234')
CORP_NAME = os.environ.get('AA_CORP_NAME', 'Alliance Auth Test Corp')
CORP_API_ID = os.environ.get('AA_CORP_API_ID', '')
CORP_API_VCODE = os.environ.get('AA_CORP_API_VCODE', '')
#########################
# Alliance Configuration
#########################
# ALLIANCE_ID - Set this to your Alliance ID (get this from https://zkillboard.com/alliance/#######)
# ALLIANCE_NAME - Set this to your Alliance Name
########################
ALLIANCE_ID = os.environ.get('AA_ALLIANCE_ID', '12345')
ALLIANCE_NAME = os.environ.get('AA_ALLIANCE_NAME', 'Alliance Auth Test Alliance')
########################
# API Configuration
########################
# MEMBER_API_MASK - Numeric value of minimum API mask required for members
# MEMBER_API_ACCOUNT - Require API to be for Account and not character restricted
# BLUE_API_MASK - Numeric value of minimum API mask required for blues
# BLUE_API_ACCOUNT - Require API to be for Account and not character restricted
# REJECT_OLD_APIS - Require each submitted API be newer than the latest submitted API
# REJECT_OLD_APIS_MARGIN - Margin from latest submitted API ID within which a newly submitted API is still accepted
# API_SSO_VALIDATION - Require users to prove ownership of newly entered API keys via SSO
# Requires SSO to be configured.
#######################
MEMBER_API_MASK = os.environ.get('AA_MEMBER_API_MASK', 268435455)
MEMBER_API_ACCOUNT = 'True' == os.environ.get('AA_MEMBER_API_ACCOUNT', 'True')
BLUE_API_MASK = os.environ.get('AA_BLUE_API_MASK', 8388608)
BLUE_API_ACCOUNT = 'True' == os.environ.get('AA_BLUE_API_ACCOUNT', 'True')
REJECT_OLD_APIS = 'True' == os.environ.get('AA_REJECT_OLD_APIS', 'False')
REJECT_OLD_APIS_MARGIN = os.environ.get('AA_REJECT_OLD_APIS_MARGIN', 50)
API_SSO_VALIDATION = 'True' == os.environ.get('AA_API_SSO_VALIDATION', 'False')
####################### #######################
# EVE Provider Settings # EVE Provider Settings
####################### #######################
@ -338,6 +272,7 @@ MUMBLE_SERVER_ID = int(os.environ.get('AA_MUMBLE_SERVER_ID', '1'))
###################################### ######################################
# PHPBB3 Configuration # PHPBB3 Configuration
###################################### ######################################
PHPBB3_URL = os.environ.get('AA_FORUM_URL', '')
###################################### ######################################
# Teamspeak3 Configuration # Teamspeak3 Configuration

View File

@ -1,10 +0,0 @@
# Requirements for running unit tests on this project
# If you aren't intending to run unit tests you can ignore this file
# These packages should be installed in addition to requirements.txt
mock==2.0.0; python_version < '3.0'
nose>=1.3.7
django-nose>=1.4.4
coverage>=4.3.1
coveralls>=1.1
requests-mock>=1.2.0

18
tox.ini Normal file
View File

@ -0,0 +1,18 @@
[tox]
skipsdist = True
usedevelop = True
envlist = py{34,35,36,37}-dj{111,20}
[testenv]
setenv =
DJANGO_SETTINGS_MODULE = settings
basepython =
py34: python3.4
py35: python3.5
py36: python3.6
py37: python3.7
deps=
dj111: Django>=1.11.1,<2.0
dj20: Django>=2.0a1
install_command = pip install -e ".[testing]" -U {opts} {packages}
commands=coverage run runtests.py -v 2