Run tests needing locales in a specific tox job on travis
This commit is contained in:
Родитель
bf7612e927
Коммит
f46c764d30
|
@ -16,7 +16,7 @@ env:
|
|||
- TOXENV=addons
|
||||
- TOXENV=devhub
|
||||
- TOXENV=reviewers
|
||||
- TOXENV=amo
|
||||
- TOXENV=amo-and-locales
|
||||
- TOXENV=users
|
||||
- TOXENV=main
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ addopts = -vs --reuse-db --showlocals --tb=short
|
|||
python_files=test*.py
|
||||
markers =
|
||||
es_tests: mark a test as an elasticsearch test.
|
||||
needs_locales_compilation: mark a test as needing compiled locales to work.
|
||||
norecursedirs =
|
||||
node_modules locale static media site-static user-media tmp
|
||||
templates fixtures migrations
|
||||
|
|
|
@ -13,6 +13,7 @@ from django.core.files.storage import default_storage as storage
|
|||
from django.db import IntegrityError
|
||||
from django.utils import translation
|
||||
|
||||
import pytest
|
||||
from mock import Mock, patch
|
||||
|
||||
from olympia import amo, core
|
||||
|
@ -1920,6 +1921,7 @@ class TestCategoryModel(TestCase):
|
|||
cat = Category(type=t, slug='omg')
|
||||
assert cat.get_url_path()
|
||||
|
||||
@pytest.mark.needs_locales_compilation
|
||||
def test_name_from_constants(self):
|
||||
category = Category(
|
||||
type=amo.ADDON_EXTENSION, application=amo.FIREFOX.id,
|
||||
|
|
|
@ -9,6 +9,7 @@ from django.core.cache import cache
|
|||
from django.test.client import Client
|
||||
from django.utils.http import urlunquote
|
||||
|
||||
import pytest
|
||||
import waffle
|
||||
|
||||
from elasticsearch import Elasticsearch
|
||||
|
@ -3229,6 +3230,7 @@ class TestStaticCategoryView(TestCase):
|
|||
u'slug': u'feeds-news-blogging'
|
||||
}
|
||||
|
||||
@pytest.mark.needs_locales_compilation
|
||||
def test_name_translated(self):
|
||||
with self.assertNumQueries(0):
|
||||
response = self.client.get(self.url, HTTP_ACCEPT_LANGUAGE='de')
|
||||
|
|
|
@ -310,6 +310,7 @@ class TestOtherStuff(TestCase):
|
|||
self.assertCloseToNow(response['Expires'],
|
||||
now=datetime.now() + timedelta(days=365))
|
||||
|
||||
@pytest.mark.needs_locales_compilation
|
||||
def test_jsi18n(self):
|
||||
"""Test that the jsi18n library has an actual catalog of translations
|
||||
rather than just identity functions."""
|
||||
|
|
|
@ -754,6 +754,7 @@ class TestEditThemeOwnerForm(TestCase):
|
|||
|
||||
class TestDistributionChoiceForm(TestCase):
|
||||
|
||||
@pytest.mark.needs_locales_compilation
|
||||
def test_lazy_choice_labels(self):
|
||||
"""Tests that the labels in `choices` are still lazy
|
||||
|
||||
|
|
|
@ -252,6 +252,7 @@ class TestFileViewer(TestCase):
|
|||
assert res == ''
|
||||
assert self.viewer.selected['msg'].startswith('File size is')
|
||||
|
||||
@pytest.mark.needs_locales_compilation
|
||||
@patch.object(settings, 'FILE_VIEWER_SIZE_LIMIT', 5)
|
||||
def test_file_size_unicode(self):
|
||||
with self.activate(locale='he'):
|
||||
|
|
|
@ -6,6 +6,7 @@ from django.conf import settings
|
|||
from django.utils.encoding import smart_text
|
||||
|
||||
import mock
|
||||
import pytest
|
||||
|
||||
from pyquery import PyQuery as pq
|
||||
|
||||
|
@ -94,6 +95,7 @@ class ThemeReviewTestMixin(object):
|
|||
assert ThemeLock.objects.filter(reviewer=reviewer).count() == (
|
||||
len(expected))
|
||||
|
||||
@pytest.mark.needs_locales_compilation
|
||||
@mock.patch('olympia.amo.messages.success')
|
||||
@mock.patch('olympia.reviewers.tasks.reject_rereview')
|
||||
@mock.patch('olympia.reviewers.tasks.approve_rereview')
|
||||
|
|
23
tox.ini
23
tox.ini
|
@ -17,44 +17,39 @@ whitelist_externals =
|
|||
[testenv:es]
|
||||
commands =
|
||||
make -f Makefile-docker update_deps
|
||||
bash {toxinidir}/locale/compile-mo.sh {toxinidir}/locale/
|
||||
py.test -m es_tests --ignore=tests/ui/ -v {posargs}
|
||||
py.test -m "es_tests and not needs_locales_compilation" --ignore=tests/ui/ -v {posargs}
|
||||
|
||||
[testenv:addons]
|
||||
commands =
|
||||
make -f Makefile-docker update_deps
|
||||
bash {toxinidir}/locale/compile-mo.sh {toxinidir}/locale/
|
||||
py.test -n 2 -m 'not es_tests' -v src/olympia/addons/ {posargs}
|
||||
py.test -n 2 -m 'not es_tests and not needs_locales_compilation' -v src/olympia/addons/ {posargs}
|
||||
|
||||
[testenv:devhub]
|
||||
commands =
|
||||
make -f Makefile-docker update_deps
|
||||
bash {toxinidir}/locale/compile-mo.sh {toxinidir}/locale/
|
||||
py.test -n 2 -m 'not es_tests' -v src/olympia/devhub/ {posargs}
|
||||
py.test -n 2 -m 'not es_tests and not needs_locales_compilation' -v src/olympia/devhub/ {posargs}
|
||||
|
||||
[testenv:reviewers]
|
||||
commands =
|
||||
make -f Makefile-docker update_deps
|
||||
bash {toxinidir}/locale/compile-mo.sh {toxinidir}/locale/
|
||||
py.test -n 2 -m 'not es_tests' -v src/olympia/reviewers/ {posargs}
|
||||
py.test -n 2 -m 'not es_tests and not needs_locales_compilation' -v src/olympia/reviewers/ {posargs}
|
||||
|
||||
[testenv:amo]
|
||||
[testenv:amo-and-locales]
|
||||
commands =
|
||||
make -f Makefile-docker update_deps
|
||||
bash {toxinidir}/locale/compile-mo.sh {toxinidir}/locale/
|
||||
py.test -n 2 -m 'not es_tests' -v src/olympia/amo/ {posargs}
|
||||
py.test -n 2 -m 'not es_tests and not needs_locales_compilation' -v src/olympia/amo/ {posargs}
|
||||
py.test -n 2 -m 'needs_locales_compilation' -v src/olympia/ {posargs}
|
||||
|
||||
[testenv:users]
|
||||
commands =
|
||||
make -f Makefile-docker update_deps
|
||||
bash {toxinidir}/locale/compile-mo.sh {toxinidir}/locale/
|
||||
py.test -n 2 -m 'not es_tests' -v src/olympia/users/ {posargs}
|
||||
py.test -n 2 -m 'not es_tests and not needs_locales_compilation' -v src/olympia/users/ {posargs}
|
||||
|
||||
[testenv:main]
|
||||
commands =
|
||||
make -f Makefile-docker update_deps
|
||||
bash {toxinidir}/locale/compile-mo.sh {toxinidir}/locale/
|
||||
py.test -n 2 -m 'not es_tests' -v src/olympia/ --ignore src/olympia/addons/ --ignore src/olympia/devhub/ --ignore src/olympia/reviewers/ --ignore src/olympia/amo/ --ignore src/olympia/users/ {posargs}
|
||||
py.test -n 2 -m 'not es_tests and not needs_locales_compilation' -v src/olympia/ --ignore src/olympia/addons/ --ignore src/olympia/devhub/ --ignore src/olympia/reviewers/ --ignore src/olympia/amo/ --ignore src/olympia/users/ {posargs}
|
||||
|
||||
[testenv:ui-tests]
|
||||
commands =
|
||||
|
|
Загрузка…
Ссылка в новой задаче