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