зеркало из https://github.com/mozilla/treeherder.git
Bug 1527020 - Travis: Enable unit tests under Python 3 (#4619)
To help prevent regressions whilst the remaining xfailed tests are fixed.
This commit is contained in:
Родитель
35687e9578
Коммит
7060eef007
26
.travis.yml
26
.travis.yml
|
@ -71,9 +71,9 @@ matrix:
|
|||
# https://docs.python.org/2/using/cmdline.html#cmdoption-3
|
||||
- python -3 -m pytest tests/selenium/ --driver Firefox
|
||||
|
||||
- env: python3-smoketest
|
||||
- env: python3-main
|
||||
language: python
|
||||
python: '3.6.5'
|
||||
python: '3.7.2'
|
||||
cache:
|
||||
directories:
|
||||
- ${HOME}/venv
|
||||
|
@ -83,11 +83,27 @@ matrix:
|
|||
- mysql -u root -e 'create database test_treeherder;'
|
||||
script:
|
||||
- pip check
|
||||
- python lints/queuelint.py
|
||||
- flake8 --show-source
|
||||
- isort --check-only --diff --quiet
|
||||
- SITE_URL='https://treeherder.dev' TREEHERDER_DEBUG='False' ./manage.py check --deploy --fail-level WARNING
|
||||
# Remove these once we get the roughly equivalent pytest sanity tests working under Python 3.
|
||||
- ./manage.py migrate
|
||||
- ./manage.py makemigrations --check
|
||||
- pytest tests/ --runslow --ignore=tests/selenium/
|
||||
|
||||
- env: python3-tests-selenium
|
||||
language: python
|
||||
python: '3.7.2'
|
||||
cache:
|
||||
directories:
|
||||
- ${HOME}/venv
|
||||
- node_modules
|
||||
install:
|
||||
- nvm install 11
|
||||
- source ./bin/travis-setup.sh services python_env geckodriver js_env
|
||||
before_script:
|
||||
# Run in `before_script` to prevent the selenium tests from still being run if the UI build fails.
|
||||
- yarn build
|
||||
script:
|
||||
- pytest tests/selenium/ --driver Firefox
|
||||
|
||||
notifications:
|
||||
email:
|
||||
|
|
|
@ -5,6 +5,7 @@ import pytest
|
|||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.urls import reverse
|
||||
from six import PY3
|
||||
|
||||
from treeherder.auth.backends import (AuthBackend,
|
||||
AuthenticationFailed)
|
||||
|
@ -35,16 +36,17 @@ def test_get_username_from_userinfo(user_info, exp_username, exp_exception):
|
|||
@pytest.mark.django_db
|
||||
@pytest.mark.parametrize(
|
||||
('exp_username', 'email', 'exp_create_user'),
|
||||
[('email/user@foo.com',
|
||||
'user@foo.com',
|
||||
True),
|
||||
('email/emailaddressexceeding30chars@foo.com',
|
||||
'emailaddressexceeding30chars@foo.com',
|
||||
True),
|
||||
('email/foo@bar.net',
|
||||
'foo@bar.net',
|
||||
False),
|
||||
])
|
||||
[
|
||||
('email/user@foo.com', 'user@foo.com', True),
|
||||
('email/emailaddressexceeding30chars@foo.com', 'emailaddressexceeding30chars@foo.com', True),
|
||||
pytest.param(
|
||||
'email/foo@bar.net', 'foo@bar.net', False,
|
||||
marks=pytest.mark.xfail(
|
||||
PY3, reason='Python 3: < not supported between instances of str and int (bug 1453837)'
|
||||
)
|
||||
),
|
||||
]
|
||||
)
|
||||
def test_existing_email_create_user(test_user, client, monkeypatch, exp_username, email, exp_create_user):
|
||||
"""
|
||||
Test whether a user was created or not, despite an existing user with
|
||||
|
|
|
@ -4,6 +4,7 @@ import json
|
|||
import pytest
|
||||
from django.forms import model_to_dict
|
||||
from mock import MagicMock
|
||||
from six import PY3
|
||||
|
||||
from tests.test_utils import add_log_response
|
||||
from treeherder.client.thclient import client
|
||||
|
@ -53,6 +54,7 @@ def check_job_log(test_repository, job_guid, parse_status):
|
|||
assert job_logs[0].status == parse_status
|
||||
|
||||
|
||||
@pytest.mark.xfail(PY3, reason='Python 3: a bytes-like object is required, not str (bug 1526743)')
|
||||
def test_store_job_with_unparsed_log(test_repository, failure_classifications,
|
||||
push_stored, monkeypatch, activate_responses):
|
||||
"""
|
||||
|
@ -97,6 +99,7 @@ def test_store_job_with_unparsed_log(test_repository, failure_classifications,
|
|||
assert len(get_error_summary(Job.objects.get(id=1))) == 2
|
||||
|
||||
|
||||
@pytest.mark.xfail(PY3, reason='Python 3: a bytes-like object is required, not str (bug 1526743)')
|
||||
def test_store_job_pending_to_completed_with_unparsed_log(test_repository, push_stored,
|
||||
failure_classifications,
|
||||
activate_responses):
|
||||
|
|
|
@ -2,15 +2,11 @@ from __future__ import unicode_literals
|
|||
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from treeherder.etl.artifact import store_job_artifacts
|
||||
from treeherder.model.models import (JobDetail,
|
||||
TextLogError,
|
||||
TextLogStep)
|
||||
|
||||
xfail = pytest.mark.xfail
|
||||
|
||||
|
||||
def test_load_long_job_details(test_job):
|
||||
def max_length(field):
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import pytest
|
||||
import responses
|
||||
from six import PY3
|
||||
|
||||
from tests import test_utils
|
||||
from tests.test_utils import add_log_response
|
||||
from treeherder.log_parser.artifactbuildercollection import ArtifactBuilderCollection
|
||||
from treeherder.log_parser.artifactbuilders import BuildbotJobArtifactBuilder
|
||||
|
||||
pytestmark = pytest.mark.xfail(PY3, reason='Python 3: a bytes-like object is required, not str (bug 1526743)')
|
||||
|
||||
|
||||
@responses.activate
|
||||
def do_test(log):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import pytest
|
||||
import responses
|
||||
from six import PY3
|
||||
|
||||
from tests import test_utils
|
||||
from tests.test_utils import add_log_response
|
||||
|
@ -8,6 +9,8 @@ from treeherder.log_parser.artifactbuilders import BuildbotLogViewArtifactBuilde
|
|||
|
||||
slow = pytest.mark.slow
|
||||
|
||||
pytestmark = pytest.mark.xfail(PY3, reason='Python 3: a bytes-like object is required, not str (bug 1526743)')
|
||||
|
||||
|
||||
@responses.activate
|
||||
def do_test(log):
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import pytest
|
||||
import responses
|
||||
from jsonschema import validate
|
||||
from six import PY3
|
||||
|
||||
from tests.test_utils import add_log_response
|
||||
from treeherder.etl.perf import PERFHERDER_SCHEMA
|
||||
|
@ -7,6 +9,7 @@ from treeherder.log_parser.artifactbuildercollection import ArtifactBuilderColle
|
|||
from treeherder.log_parser.artifactbuilders import BuildbotPerformanceDataArtifactBuilder
|
||||
|
||||
|
||||
@pytest.mark.xfail(PY3, reason='Python 3: a bytes-like object is required, not str (bug 1526743)')
|
||||
@responses.activate
|
||||
def test_performance_log_parsing():
|
||||
"""
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from __future__ import print_function
|
||||
|
||||
import pytest
|
||||
from six import PY3
|
||||
|
||||
from tests.test_utils import add_log_response
|
||||
from treeherder.etl.jobs import store_job_data
|
||||
|
@ -27,6 +28,7 @@ def jobs_with_local_log(activate_responses):
|
|||
return [job]
|
||||
|
||||
|
||||
@pytest.mark.xfail(PY3, reason='Python 3: a bytes-like object is required, not str (bug 1526743)')
|
||||
def test_parse_log(test_repository, failure_classifications, jobs_with_local_log, sample_push):
|
||||
"""
|
||||
check that 2 job_artifacts get inserted when running a parse_log task for
|
||||
|
@ -47,6 +49,7 @@ def test_parse_log(test_repository, failure_classifications, jobs_with_local_log
|
|||
print(JobDetail.objects.count() == 4)
|
||||
|
||||
|
||||
@pytest.mark.xfail(PY3, reason='Python 3: a bytes-like object is required, not str (bug 1526743)')
|
||||
def test_create_error_summary(failure_classifications,
|
||||
jobs_with_local_log, sample_push,
|
||||
test_repository):
|
||||
|
|
|
@ -8,6 +8,7 @@ from rest_framework import status
|
|||
from rest_framework.decorators import APIView
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.test import APIRequestFactory
|
||||
from six import PY3
|
||||
|
||||
from treeherder.auth.backends import AuthBackend
|
||||
from treeherder.model.models import User
|
||||
|
@ -47,6 +48,7 @@ def test_post_no_auth():
|
|||
|
||||
# Auth Login and Logout Tests
|
||||
|
||||
@pytest.mark.xfail(PY3, reason='Python 3: < not supported between instances of str and int (bug 1453837)')
|
||||
def test_auth_login_and_logout(test_ldap_user, client, monkeypatch):
|
||||
"""LDAP login user exists, has scope: find by email"""
|
||||
def userinfo_mock(selfless, request):
|
||||
|
@ -136,6 +138,7 @@ def test_login_no_email(test_user, client, monkeypatch):
|
|||
assert resp.json()["detail"] == "Unrecognized identity"
|
||||
|
||||
|
||||
@pytest.mark.xfail(PY3, reason='Python 3: < not supported between instances of str and int (bug 1453837)')
|
||||
@pytest.mark.django_db
|
||||
def test_login_not_active(test_ldap_user, client, monkeypatch):
|
||||
"""LDAP login, user not active"""
|
||||
|
|
Загрузка…
Ссылка в новой задаче