From bb81a98c02ef04ebadcbd74daf0cef64498cf192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 20:09:14 -0300 Subject: [PATCH 01/13] =?UTF-8?q?Desnecess=C3=A1rio=20conter=20os=20pacote?= =?UTF-8?q?s=20que=20o=20virtualenv=20instala=20por=20padr=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index edbf03d..3d591c5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,4 @@ Django==1.7 Markdown==2.4.1 -argparse==1.2.1 django-markdown==0.6.1 django-taggit==0.12.1 -wsgiref==0.1.2 From 6687c44b7f1ea445aa207fe58979fa45c333679b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 20:10:13 -0300 Subject: [PATCH 02/13] =?UTF-8?q?Dependencia=20que=20=C3=A9=20resolvida=20?= =?UTF-8?q?pelo=20django-markdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3d591c5..38e0243 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ Django==1.7 -Markdown==2.4.1 + django-markdown==0.6.1 django-taggit==0.12.1 From da686160f409b61a40c7b35c5dba499d848b9df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 20:13:50 -0300 Subject: [PATCH 03/13] lista as ferramentas de testes --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requirements.txt b/requirements.txt index 38e0243..f595cf9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,6 @@ Django==1.7 django-markdown==0.6.1 django-taggit==0.12.1 + +coverage==3.7.1 +python-coveralls==2.4.2 From e38c0a6ac91f2712b070c598c55cdc0b89dc430e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 20:16:44 -0300 Subject: [PATCH 04/13] arquivos do ambiente --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 48fb241..7aeac1b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ __pycache__/ *.so # Distribution / packaging +.env +.venv .Python env/ bin/ From a693b4efe8dcd196cbada0698cb067f86035f6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 20:17:19 -0300 Subject: [PATCH 05/13] dj-database-url --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index f595cf9..c08f00d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ Django==1.7 +dj-database-url==0.3.0 django-markdown==0.6.1 django-taggit==0.12.1 From 3e1be3473efe1c15adc20711886ab3c8e9a854c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 20:35:58 -0300 Subject: [PATCH 06/13] Prepara os testes --- .env-example | 1 + .travis.yml | 19 +++++++++++++------ blog/tests.py | 13 ++++++++++++- project/settings.py | 9 +++------ requirements.txt | 2 ++ 5 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 .env-example 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/.travis.yml b/.travis.yml index ac8abc1..73cb082 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 + - DJANGO_SETTINGS_MODULE=project.settings.test +services: + - postgresql install: - - pip install -r requirements.txt --use-mirrors -script: + - pip install -r requirements.txt +before_script: + - psql -c 'create database travis_ci_test;' -U postgres - python manage.py makemigrations - - python manage.py migrate - - python manage.py test + - python manage.py migrate --noinput +script: + - coverage run manage.py test +after_success: + - coveralls 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 c08f00d..ab4af9e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,5 +4,7 @@ dj-database-url==0.3.0 django-markdown==0.6.1 django-taggit==0.12.1 +psycopg2==2.5.4 + coverage==3.7.1 python-coveralls==2.4.2 From b63226133c8f86a4f751d934f38261a3efadd3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 20:46:40 -0300 Subject: [PATCH 07/13] coveralls badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c311b8..9ff6ae6 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) +[![Coverage Status](https://img.shields.io/coveralls/pythonclub/ublog.svg)](https://coveralls.io/r/pythonclub/ublog) [![Build Status](https://travis-ci.org/igr-santos/ublog.svg?branch=master)](https://travis-ci.org/igr-santos/ublog) Plataforma para Blog colaborativo escrita em Python From cb98a4391dc4378a5d1b79fbecc7e9cd258cdf09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 20:47:38 -0300 Subject: [PATCH 08/13] travis badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ff6ae6..b80ac68 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ublog ===== -[![Coverage Status](https://img.shields.io/coveralls/pythonclub/ublog.svg)](https://coveralls.io/r/pythonclub/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 From 03886ead84b18956d118c7c6bf813808e560d4d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 20:48:32 -0300 Subject: [PATCH 09/13] =?UTF-8?q?Desnecess=C3=A1rio=20por=20hora=20ter=20u?= =?UTF-8?q?m=20modulo=20de=20settings=20separado=20pra=20testes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 73cb082..229fc9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ language: python python: - 2.7 - 3.4 -env: - - DJANGO_SETTINGS_MODULE=project.settings.test +#env: +# - DJANGO_SETTINGS_MODULE=project.settings.test services: - postgresql install: From 75ea6ae315fe17c810e252328fc15fdbd53221d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 20:55:05 -0300 Subject: [PATCH 10/13] variavel com database pro travis --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 229fc9c..4a890d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,9 @@ language: python python: - 2.7 - 3.4 -#env: -# - DJANGO_SETTINGS_MODULE=project.settings.test +env: + global: + - DATABASE_URL=postgres://postgres@localhost/travis_ci_test services: - postgresql install: From 78a97276788887985b4561be8fc586f855075a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 21:00:13 -0300 Subject: [PATCH 11/13] =?UTF-8?q?executa=20s=C3=B3=20as=20migra=C3=A7?= =?UTF-8?q?=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4a890d7..7b58f24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ install: - pip install -r requirements.txt before_script: - psql -c 'create database travis_ci_test;' -U postgres - - python manage.py makemigrations - python manage.py migrate --noinput script: - coverage run manage.py test From a0c31548ee29f2274bd8c663b943924790093c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 21:27:00 -0300 Subject: [PATCH 12/13] Agora passa no py34 e adicionei o tox pra testar localmente --- .gitignore | 1 + blog/migrations/0002_auto_20140910_0228.py | 2 +- requirements.txt | 1 + tox.ini | 7 +++++++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore index 7aeac1b..6f55497 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ __pycache__/ .env .venv .Python +.python-version env/ bin/ build/ 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/requirements.txt b/requirements.txt index ab4af9e..e326dc1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,3 +8,4 @@ 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 From 9c80a6d9620d91c15b7cfdccbccb3e7a68e085d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Luiz?= Date: Thu, 18 Sep 2014 21:34:43 -0300 Subject: [PATCH 13/13] =?UTF-8?q?adiciona=20.coveragerc=20para=20testarmos?= =?UTF-8?q?=20s=C3=B3=20o=20nosso=20codigo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .coveragerc | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .coveragerc 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