Add tox support

This commit is contained in:
Gergely Polonkai 2015-11-26 17:15:12 +01:00
parent a53b2827a9
commit e00515c160
6 changed files with 31 additions and 0 deletions

2
.gitignore vendored
View File

@ -2,3 +2,5 @@
.coverage .coverage
db.sqlite3 db.sqlite3
/htmlcov/ /htmlcov/
/.tox/
MANIFEST

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
Django==1.8.7

11
setup.py Normal file
View File

@ -0,0 +1,11 @@
#! /usr/bin/env python
from distutils.core import setup
setup(name='WordChallenge',
version='0.1',
description='100(ish) word challenge',
author='Gergely Polonkai',
author_email='gergely@polonkai.eu',
url='https://github.com/gergelypolonkai/word-challenge',
packages=['wordchallenge', 'words'])

13
tox.ini Normal file
View File

@ -0,0 +1,13 @@
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
[tox]
envlist = py27,py34
[testenv]
commands = coverage run manage.py test
deps =
-rrequirements.txt
coverage

View File

@ -2,8 +2,10 @@ from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import get_language from django.utils.translation import get_language
@python_2_unicode_compatible
class Word(models.Model): class Word(models.Model):
def translation(self, language): def translation(self, language):
try: try:
@ -25,6 +27,7 @@ class Word(models.Model):
return "" return ""
@python_2_unicode_compatible
class WordTranslation(models.Model): class WordTranslation(models.Model):
word = models.ForeignKey(Word, related_name='translations') word = models.ForeignKey(Word, related_name='translations')
language = models.CharField(max_length=5, db_index=True) language = models.CharField(max_length=5, db_index=True)

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8
from datetime import timedelta from datetime import timedelta
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User