Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use pytest (bug 1090184) #369

Merged
merged 1 commit into from
Dec 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ media/marketplace-stats
*.po~
site-static/*
user-media/*
.tox/
.cache/
MANIFEST
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
language: python
python:
- "2.6"
- "2.7"
env:
- TOX_ENV=flake8
- TOX_ENV=docs
- TOX_ENV=es
- TOX_ENV=addons-devhub-editors
- TOX_ENV=main
services:
- memcached
before_install:
- sudo apt-get install swig
- wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.2.deb && sudo dpkg -i elasticsearch-1.3.2.deb
- sudo /usr/share/elasticsearch/bin/elasticsearch -d -D es.path.data=/tmp -D es.gateway.type=none -D es.index.store.type=memory -D es.discovery.zen.ping.multicast.enabled=false
install:
- make update_deps
- npm install
- pip install tox
before_script:
- mysql -e 'create database olympia;'
- make update_assets
script:
- DJANGO_SETTINGS_MODULE=settings_ci make flake8 && DJANGO_SETTINGS_MODULE=settings_ci make test
- make docs SPHINXOPTS='-nW'
- tox -v -e $TOX_ENV --recreate
notifications:
irc:
channels:
Expand Down
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help docs test test_force_db tdd test_failed initialize_db populate_data update_code update_deps update_db update_assets full_init full_update reindex flake8
.PHONY: help docs test test_es test_no_es test_force_db tdd test_failed initialize_db populate_data update_code update_deps update_db update_assets full_init full_update reindex flake8
NUM_ADDONS=10
NUM_THEMES=$(NUM_ADDONS)

Expand Down Expand Up @@ -26,16 +26,22 @@ docs:
$(MAKE) -C docs html

test:
REUSE_DB=1 python manage.py test --with-blockage --noinput --logging-clear-handlers --with-id -v 2 $(ARGS)
py.test $(ARGS)

test_es:
py.test -m es_tests $(ARGS)

test_no_es:
py.test -m "not es_tests" $(ARGS)

test_force_db:
python manage.py test --with-blockage --noinput --logging-clear-handlers --with-id -v 2 $(ARGS)
py.test --create-db $(ARGS)

tdd:
REUSE_DB=1 python manage.py test --with-blockage --noinput --failfast --pdb --with-id -v 2 $(ARGS)
py.test -x --pdb $(ARGS)

test_failed:
REUSE_DB=1 python manage.py test --with-blockage --noinput --logging-clear-handlers --with-id -v 2 --failed $(ARGS)
py.test --lf $(ARGS)

initialize_db:
python manage.py reset_db
Expand Down
4 changes: 4 additions & 0 deletions apps/access/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.http import HttpRequest

import mock
import pytest
from nose.tools import assert_false

import amo
Expand All @@ -14,6 +15,9 @@
match_rules)


pytestmark = pytest.mark.django_db


def test_match_rules():
"""
Unit tests for the match_rules method.
Expand Down