diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..92096fe --- /dev/null +++ b/.coveragerc @@ -0,0 +1,4 @@ +[run] +branch=True +source=. +omit=project/wsgi.py, manage.py diff --git a/.env-example b/.env-example new file mode 100644 index 0000000..b418628 --- /dev/null +++ b/.env-example @@ -0,0 +1 @@ +DATABASE_URL=postgres://postgres@localhost/blog diff --git a/.gitignore b/.gitignore index 48fb241..6f55497 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,10 @@ __pycache__/ *.so # Distribution / packaging +.env +.venv .Python +.python-version env/ bin/ build/ diff --git a/.travis.yml b/.travis.yml index ac8abc1..7b58f24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,18 @@ language: python python: - - "2.7" + - 2.7 + - 3.4 env: - - DJANGO=1.7 DB=sqlite3 + global: + - DATABASE_URL=postgres://postgres@localhost/travis_ci_test +services: + - postgresql install: - - pip install -r requirements.txt --use-mirrors + - pip install -r requirements.txt +before_script: + - psql -c 'create database travis_ci_test;' -U postgres + - python manage.py migrate --noinput script: - - python manage.py makemigrations - - python manage.py migrate - - python manage.py test + - coverage run manage.py test +after_success: + - coveralls diff --git a/README.md b/README.md index 5c311b8..b80ac68 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ublog ===== -[![Coverage Status](https://coveralls.io/repos/igr-santos/ublog/badge.png)](https://coveralls.io/r/igr-santos/ublog) [![Build Status](https://travis-ci.org/igr-santos/ublog.svg?branch=master)](https://travis-ci.org/igr-santos/ublog) +[![Build Status](https://travis-ci.org/pythonclub/ublog.svg)](https://travis-ci.org/pythonclub/ublog) [![Coverage Status](https://img.shields.io/coveralls/pythonclub/ublog.svg)](https://coveralls.io/r/pythonclub/ublog) Plataforma para Blog colaborativo escrita em Python diff --git a/blog/migrations/0002_auto_20140910_0228.py b/blog/migrations/0002_auto_20140910_0228.py index d7daee8..6720633 100644 --- a/blog/migrations/0002_auto_20140910_0228.py +++ b/blog/migrations/0002_auto_20140910_0228.py @@ -32,7 +32,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('object_id', models.IntegerField(verbose_name='Object id', db_index=True)), ('content_type', models.ForeignKey(related_name='blog_taggedwhatever_tagged_items', verbose_name='Content type', to='contenttypes.ContentType')), - ('tag', models.ForeignKey(related_name=b'blog_taggedwhatever_items', to='blog.Tag')), + ('tag', models.ForeignKey(related_name='blog_taggedwhatever_items', to='blog.Tag')), ], options={ 'abstract': False, diff --git a/blog/tests.py b/blog/tests.py index 7ce503c..e55c7c3 100644 --- a/blog/tests.py +++ b/blog/tests.py @@ -1,3 +1,14 @@ +# -*- coding: utf-8 -*- + from django.test import TestCase -# Create your tests here. + +class EntryListTest(TestCase): + def setUp(self): + self.res = self.client.get('/') + + def test_status_code(self): + self.assertEqual(self.res.status_code, 200) + + def test_template_used(self): + self.assertTemplateUsed('entry_list.html') diff --git a/project/settings.py b/project/settings.py index b68f9c5..c896a50 100644 --- a/project/settings.py +++ b/project/settings.py @@ -61,12 +61,9 @@ # Database # https://docs.djangoproject.com/en/1.7/ref/settings/#databases -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } -} +import dj_database_url +DATABASES = {'default': dj_database_url.config()} + SOUTH_MIGRATION_MODULES = { 'taggit': 'taggit.south_migrations', diff --git a/requirements.txt b/requirements.txt index edbf03d..e326dc1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,11 @@ Django==1.7 -Markdown==2.4.1 -argparse==1.2.1 + +dj-database-url==0.3.0 django-markdown==0.6.1 django-taggit==0.12.1 -wsgiref==0.1.2 + +psycopg2==2.5.4 + +coverage==3.7.1 +python-coveralls==2.4.2 +tox==1.7.2 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..91bf158 --- /dev/null +++ b/tox.ini @@ -0,0 +1,7 @@ +[tox] +envlist = py27,py34 +skipsdist = True + +[testenv] +deps = -rrequirements.txt +commands = python manage.py test