forked from vikingco/django-keyvaluestore
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from sdelements/tech/pas/130_ci_tests
Add CI tests
- Loading branch information
Showing
9 changed files
with
121 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
sudo: false | ||
language: python | ||
python: | ||
- "2.7" | ||
- "3.6" | ||
install: | ||
- "pip install flake8==2.6.2" | ||
jobs: | ||
include: | ||
- python: "2.7" | ||
env: DJANGO=1.11 LINT=true | ||
- python: "3.6" | ||
env: DJANGO=1.11 LINT=true | ||
- python: "3.6" | ||
env: DJANGO=2.0 | ||
- python: "3.6" | ||
env: DJANGO=2.1 | ||
- python: "3.6" | ||
env: DJANGO=2.2 | ||
- python: "3.6" | ||
env: DJANGO=3.0 | ||
script: | ||
- "make lint" | ||
- "./ci.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
lint: | ||
find . -name '*.py' | xargs flake8 --ignore=E501,W601 | ||
|
||
test: | ||
(cd testing; python manage.py test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
if [ "${LINT}" = "true" ]; then | ||
pip install flake8==2.6.2 | ||
make lint | ||
fi | ||
|
||
python setup.py install | ||
pip install django=="${DJANGO}" | ||
make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/usr/bin/env python | ||
from setuptools import setup, find_packages | ||
from setuptools import setup | ||
import keyvaluestore | ||
|
||
|
||
|
@@ -12,7 +12,7 @@ | |
long_description=open('README.rst', 'r').read(), | ||
author='Unleashed NV', | ||
author_email='[email protected]', | ||
packages=find_packages('.'), | ||
packages=['keyvaluestore'], | ||
zip_safe=False, | ||
classifiers=[ | ||
'Intended Audience :: Developers', | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import sys | ||
|
||
path, scriptname = os.path.split(__file__) | ||
|
||
sys.path.append(os.path.abspath(path)) | ||
sys.path.append(os.path.abspath(os.path.join(path, '..'))) | ||
|
||
if __name__ == "__main__": | ||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") | ||
|
||
from django.core.management import execute_from_command_line | ||
|
||
execute_from_command_line(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import os as _os | ||
|
||
_PROJECT_PATH = _os.path.abspath(_os.path.dirname(__file__)) | ||
|
||
DEBUG = True | ||
ADMINS = () | ||
MANAGERS = ADMINS | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': 'testing.db', | ||
'USER': '', | ||
'PASSWORD': '', | ||
'HOST': '', | ||
'PORT': '', | ||
} | ||
} | ||
TIME_ZONE = 'America/Chicago' | ||
USE_TZ = True | ||
LANGUAGE_CODE = 'en-us' | ||
SITE_ID = 1 | ||
USE_I18N = True | ||
USE_L10N = True | ||
|
||
SECRET_KEY = 'p_2zsf+@4uw$kcdl$!tkf0lrh%w^!#@2@iwo4plef2n$(@uj4_' | ||
|
||
MIDDLEWARE = ( | ||
'django.middleware.common.CommonMiddleware', | ||
) | ||
|
||
INSTALLED_APPS = ( | ||
'keyvaluestore', | ||
'tests' | ||
) | ||
|
||
LOGGING = { | ||
'version': 1, | ||
'disable_existing_loggers': False, | ||
'handlers': { | ||
'console': { | ||
'level': 'DEBUG', | ||
'class': 'logging.StreamHandler', | ||
}, | ||
}, | ||
'loggers': { | ||
'': { | ||
'handlers': ['console'], | ||
'level': 'WARNING', | ||
'propagate': True, | ||
}, | ||
}, | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from django.test import TestCase | ||
|
||
from keyvaluestore.utils import ( | ||
get_value_for_key, | ||
get_value_or_default, | ||
set_key_value | ||
) | ||
|
||
|
||
class KeyValueStoreTests(TestCase): | ||
def test_get_value_for_missing_key(self): | ||
self.assertRaises(KeyError, get_value_for_key, "nonexistent") | ||
|
||
def test_get_value_or_default(self): | ||
default_value = "default123" | ||
self.assertEqual(get_value_or_default("nonexistent", default_value), default_value) | ||
|
||
def test_set_value_for_keyt(self): | ||
key = "cache_key" | ||
expected_value = "apple123" | ||
set_key_value(key, expected_value) | ||
|
||
self.assertEqual(get_value_for_key(key), expected_value) |