-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
206 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
language: python | ||
python: | ||
- '3.5.1' | ||
|
||
before_install: | ||
- pip install nose | ||
- pip install coverage | ||
- pip install coveralls | ||
|
||
install: pip install -r requirements.txt | ||
|
||
before_script: | ||
- psql -c 'create database partisan;' -U postgres | ||
|
||
script: make test | ||
|
||
after_success: coveralls | ||
|
||
env: | ||
global: | ||
- DJANGO_SETTINGS_MODULE=partisan.settings.testing | ||
- SECRET_KEY=supersecretkey | ||
- DATABASE_URL=postgres://localhost/partisan | ||
- EMAIL_HOST_USER='' | ||
- EMAIL_HOST_PASSWORD='' | ||
- GOOGLE_OAUTH2_KEY='' | ||
- GOOGLE_OAUTH2_SECRET='' | ||
|
||
notifications: | ||
email: | ||
recipients: | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
on_success: change | ||
on_failure: always |
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
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,26 @@ | ||
# partisan | ||
# The project module for the Partisan Discourse web application. | ||
# | ||
# Author: Benjamin Bengfort <[email protected]> | ||
# Created: Sat Jul 16 11:38:44 2016 -0400 | ||
# | ||
# Copyright (C) 2016 District Data Labs | ||
# For license information, see LICENSE.txt | ||
# | ||
# ID: __init__.py [] [email protected] $ | ||
|
||
""" | ||
The project module for the Partisan Discourse web application. | ||
""" | ||
|
||
########################################################################## | ||
## Imports | ||
########################################################################## | ||
|
||
from .version import get_version | ||
|
||
########################################################################## | ||
## Project Info | ||
########################################################################## | ||
|
||
__version__ = get_version() |
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
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,18 @@ | ||
# partisan.tests | ||
# Tests for the complete partisan package. | ||
# | ||
# Author: Benjamin Bengfort <[email protected]> | ||
# Created: Sat Jul 16 11:36:08 2016 -0400 | ||
# | ||
# Copyright (C) 2016 District Data Labs | ||
# For license information, see LICENSE.txt | ||
# | ||
# ID: __init__.py [] [email protected] $ | ||
|
||
""" | ||
Tests for the complete partisan package. | ||
""" | ||
|
||
########################################################################## | ||
## Imports | ||
########################################################################## |
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,57 @@ | ||
# partisan.tests.test_init | ||
# Initialization tests for the Partisan Discourse project | ||
# | ||
# Author: Benjamin Bengfort <[email protected]> | ||
# Created: Sat Jul 16 11:36:36 2016 -0400 | ||
# | ||
# Copyright (C) 2016 District Data Labs | ||
# For license information, see LICENSE.txt | ||
# | ||
# ID: test_init.py [] [email protected] $ | ||
|
||
""" | ||
Initialization tests for the Partisan Discourse project | ||
""" | ||
|
||
########################################################################## | ||
## Imports | ||
########################################################################## | ||
|
||
from unittest import TestCase | ||
|
||
########################################################################## | ||
## Module variables | ||
########################################################################## | ||
|
||
EXPECTED_VERSION = "0.1" | ||
|
||
########################################################################## | ||
## Initialization Tests | ||
########################################################################## | ||
|
||
class InitializationTests(TestCase): | ||
""" | ||
Some basic partisan tests | ||
""" | ||
|
||
def test_sanity(self): | ||
""" | ||
Check that the world is sane and 2+2=4 | ||
""" | ||
self.assertEqual(2+2, 4) | ||
|
||
def test_import(self): | ||
""" | ||
Ensure the partisan module can be imported | ||
""" | ||
try: | ||
import partisan | ||
except ImportError: | ||
self.fail("Could not import the partisan module.") | ||
|
||
def test_version(self): | ||
""" | ||
Assert that test and package versions match | ||
""" | ||
import partisan | ||
self.assertEqual(EXPECTED_VERSION, partisan.__version__) |
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,49 @@ | ||
# partisan.version | ||
# Helper module for managing versioning information | ||
# | ||
# Author: Benjamin Bengfort <[email protected]> | ||
# Created: Sat Jul 16 11:37:27 2016 -0400 | ||
# | ||
# Copyright (C) 2015 District Data Labs | ||
# For license information, see LICENSE.txt | ||
# | ||
# ID: version.py [] [email protected] $ | ||
|
||
""" | ||
Helper module for managing versioning information | ||
""" | ||
|
||
########################################################################## | ||
## Versioning | ||
########################################################################## | ||
|
||
__version_info__ = { | ||
'major': 0, | ||
'minor': 1, | ||
'micro': 0, | ||
'releaselevel': 'final', | ||
'serial': 0, | ||
} | ||
|
||
|
||
def get_version(short=False): | ||
""" | ||
Returns the version from the version info. | ||
""" | ||
if __version_info__['releaselevel'] not in ('alpha', 'beta', 'final'): | ||
raise ValueError( | ||
"unknown release level '{}', select alpha, beta, or final.".format( | ||
__version_info__['releaselevel'] | ||
) | ||
) | ||
|
||
vers = ["{major}.{minor}".format(**__version_info__)] | ||
|
||
if __version_info__['micro']: | ||
vers.append(".{micro}".format(**__version_info__)) | ||
|
||
if __version_info__['releaselevel'] != 'final' and not short: | ||
vers.append('{}{}'.format(__version_info__['releaselevel'][0], | ||
__version_info__['serial'])) | ||
|
||
return ''.join(vers) |