Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Commit

Permalink
switch to pytest test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
bubenkoff committed Apr 6, 2015
1 parent 0e8017c commit f2686d7
Show file tree
Hide file tree
Showing 35 changed files with 175 additions and 80 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
omit = tests/*
*/migrations/*
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*.egg-info
*~
*#
.coverage

# OS or Editor folders
.DS_Store
Expand All @@ -38,4 +39,6 @@ _content
_tmp
dist
build
_build
_build
/.env
/.tox
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
sudo: false
language: python
python:
# - "3.3"
# - "2.7"
- "2.6"
# install Arkestra & dependencies
env:
matrix:
- TESTENV=py26
- TESTENV=py27
- TESTENV=coveralls
install:
- pip install -r REQUIREMENTS.txt
# command to run tests, e.g. python setup.py test
script: python example/testrunner.py
- pip install tox
script: tox -e $TESTENV
14 changes: 14 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Changelog
=========

Unreleased
----------

* 2015-04-06
switch to pytest test runner (bubenkoff, christianmlong)

2.0pre1
-------

* 2012-06-17
First PyPI release
1 change: 0 additions & 1 deletion CHANGES.txt

This file was deleted.

18 changes: 18 additions & 0 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Contributors
============

Arkestra's contributors include:

* Daniele Procida
* Benjamin Rowett
* Stefan Foulis
* Patrick Lauber
* Jonas Obrist
* Bjarni Þórisson
* Luke Crooks
* Kristian Oellegaard
* Barry Rowlingson
* Hamish Downer
* Damir Arbula

... and if I have neglected to mention someone, please let me know!
15 changes: 0 additions & 15 deletions CONTRIBUTORS.txt

This file was deleted.

3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# include *.txt
# recursive-include docs *.txt
# recursive-include docs *.txt
include *.rst
graft arkestra_image_plugin
graft arkestra_utilities
graft arkestra_utilities
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# create virtual environment
.env:
virtualenv .env

# install all needed for development
develop: .env
.env/bin/pip install -e .[test] -r REQUIREMENTS.txt tox

# clean the development envrironment
clean:
-rm -rf .env
12 changes: 9 additions & 3 deletions README.txt → README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Arkestra

Arkestra is a semantic web publishing system for organisations, created in Django.

.. image:: https://api.travis-ci.org/evildmp/Arkestra.png
:target: https://travis-ci.org/evildmp/Arkestra
.. image:: https://coveralls.io/repos/evildmp/Arkestra/badge.png?branch=master
:target: https://coveralls.io/r/evildmp/Arkestra


Documentation & support
=======================

Expand Down Expand Up @@ -44,8 +50,8 @@ A large project

Arkestra currently publishes the website of Cardiff University School of Medicine: http://medicine.cf.ac.uk/; this includes information about:

* 1700 people, in
* 2700 different roles, in
* 1700 people, in
* 2700 different roles, in
* 160 entities (i.e. parts of the organisation), as well as
* 330 news articles and 570 events.

Expand Down Expand Up @@ -74,4 +80,4 @@ There is much work to be done in Arkestra. It works extremely well, but its code
* tests


It also lack some features that it should have; the most urgent of these is multilingual support.
It also lack some features that it should have; the most urgent of these is multilingual support.
4 changes: 2 additions & 2 deletions REQUIREMENTS.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-e hg+https://bitbucket.org/spookylukey/django-easyfilters#egg=django-easyfilters

-e git+https://github.com/evildmp/django-widgetry.git@master#egg=django-widgetry-evildmp
-e git+https://github.com/evildmp/django-widgetry.git@master#egg=django-widgetry

-e git+https://github.com/evildmp/django-chained-selectbox.git@master#egg=django-chained-select-box-evildmp
-e git+https://github.com/evildmp/django-chained-selectbox.git@master#egg=django-chained-selectbox
2 changes: 1 addition & 1 deletion arkestra_utilities/generic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Meta:
help_text=u"Important items will be featured in lists")

def __unicode__(self):
return self.short_title
return self.short_title or u''

@property
def has_expired(self):
Expand Down
3 changes: 1 addition & 2 deletions arkestra_utilities/templatetags/insert_tags.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from django import template
from django.template.defaultfilters import safe

from arkestra_utilities.models import Insert

from classytags.arguments import Argument
from classytags.core import Tag, Options

Expand All @@ -16,6 +14,7 @@ class RenderInserter(Tag):
)

def render_tag(self, context, insertion_point, width):
from arkestra_utilities.models import Insert
inserter, created = Insert.objects.get_or_create(insertion_point = insertion_point)
request = context.get('request', None)
if not request:
Expand Down
6 changes: 0 additions & 6 deletions arkestra_utilities/test_every_page.py

This file was deleted.

3 changes: 0 additions & 3 deletions arkestra_utilities/test_helpers.py

This file was deleted.

4 changes: 0 additions & 4 deletions arkestra_utilities/testrunner.py

This file was deleted.

2 changes: 0 additions & 2 deletions contacts_and_people/tests/__init__.py

This file was deleted.

50 changes: 33 additions & 17 deletions docs/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,15 @@ These steps assume that you have the following available on your system:
* Git
* Mercurial

Set up a virtual environment
============================
Set up a development environment
================================

::

virtualenv arkestra
cd arkestra/
source bin/activate

Install PIP components
======================

::

# install Arkestra & dependencies
pip install -e git+https://github.com/evildmp/Arkestra.git@develop#egg=Arkestra
# install the things that pip can't do automatically
pip install -r src/arkestra/REQUIREMENTS.txt

git clone https://github.com/evildmp/Arkestra.git
cd Arkestra
make develop
source .env/bin/activate

From this point you can wrestle Arkestra into submission on your own, or get started using the `example` project included.

Expand All @@ -45,7 +35,7 @@ Arkestra includes an example project for Django 1.4.

Assuming that your code was installed into src/arkestra in your virtualenv::

cd src/arkestra/example
cd example
python manage.py syncdb --noinput --all # set up a new database; don't prompt for superuser and use syncdb even on applications with migrations
python manage.py loaddata example_database.json # load the example database from the fixture

Expand All @@ -69,3 +59,29 @@ When you start up the server, you may not see any of the news/events/vacancies/s
That's because they're out of date by now - this database was created some time ago.

Go into the news/events/vacancies/studentships and give them more appropriate dates.


Run tests
=========

For tests, `pytest <http://pytest.org/latest/>`_ test framework with
nice `pytest-django <https://pypi.python.org/pypi/pytest-django/>`_ plugin is used instead of ``standard``
unittest approach recommended by Django.

To run tests:

::

py.test tests

For multipython testing, use just:

::

tox

To see test coverage:

::

tox -e coveralls
27 changes: 23 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
"""Setuptools entry point."""
import codecs
from setuptools import setup, find_packages
from os.path import join, dirname

tests_require = [
'pytest==2.7.0',
'pytest-cov==1.8.1',
'pytest-cache==1.0',
'pytest-django==2.8.0',
'pytest-pythonpath==0.6'
]

descriptions = []

for filename in ('README.rst', 'CHANGES.rst', 'CONTRIBUTORS.rst'):
with codecs.open(join(dirname(__file__), filename), encoding='utf-8') as fd:
descriptions.append(fd.read())

setup(
name='Arkestra',
version='2.0.0',
author='Daniele Procida',
author_email='daniele@vurt.org',
packages=find_packages(exclude=["example"]), # exclude the example project
packages=find_packages(exclude=["example", "tests"]), # exclude the example project
include_package_data=True,
zip_safe=False,
license='LICENSE.txt',
description='A semantic web publishing system for organisations',
long_description=open(join(dirname(__file__), 'README.txt')).read(),
long_description="\n".join(descriptions),
tests_require=tests_require,
extras_require={'test': tests_require},
install_requires=[
'django >= 1.4, <=1.4.10',
'easy-thumbnails==1.5',
Expand All @@ -22,8 +40,9 @@
'semanticeditor',
'pillow',
'django-pagination',
# will need to be restored once easyfilters is updated - see REQUIREMENTS.txt
# 'django-easyfilters',
'django-easyfilters',
'django-treeadmin',
'django-widgetry',
'django-chained-selectbox'
],
)
Empty file added test_example.db
Empty file.
Empty file added tests/__init__.py
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions tests/arkestra_utilities/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Test models."""
from arkestra_utilities.generic_models import ArkestraGenericModel


class TestModel(ArkestraGenericModel):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
from contacts_and_people.models import Entity, Person

from arkestra_utilities.text import concatenate
from generic_lister import (
from arkestra_utilities.generic_lister import (
ArkestraGenericLister, ArkestraGenericList, ArkestraGenericFilterSet,
ArkestraGenericFilterList
)
from generic_models import ArkestraGenericModel

from tests.arkestra_utilities.models import TestModel

class TestConcatenate(TestCase):
def test_concatenate_with_no_arguments(self):
Expand Down Expand Up @@ -40,10 +39,6 @@ def test_concatenate_with_unnamed_arguments(self):
)


class TestModel(ArkestraGenericModel):
pass


class TestFilterSet(ArkestraGenericFilterSet):
fields = ['title']

Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests configuration."""
Empty file.
Empty file added tests/links/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion links/tests.py → tests/links/test_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from contacts_and_people.models import (
Site, Person, Building, Entity, Membership
)
from contacts_and_people.tests import EntityTestObjectsMixin
from tests.contacts_and_people.test_contactsandpeople import EntityTestObjectsMixin


class SearchTests(EntityTestObjectsMixin, TestCase):
Expand Down
Empty file.
File renamed without changes.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

from contacts_and_people.models import Person

from models import Vacancy, Studentship
from lister import (
from vacancies_and_studentships.models import Vacancy, Studentship
from vacancies_and_studentships.lister import (
List, VacanciesAndStudentshipsPluginLister, FilterList
)

Expand Down
Loading

0 comments on commit f2686d7

Please sign in to comment.