Skip to content

Commit

Permalink
updates travis config
Browse files Browse the repository at this point in the history
  • Loading branch information
saxix committed Apr 5, 2015
1 parent 444e0cc commit 366694a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions tests/conftest.py
@@ -1,5 +1,6 @@
import sys
import warnings
import django
import pytest


Expand All @@ -16,3 +17,5 @@ def pytest_configure(config):


windows = pytest.mark.skipif(sys.platform != 'win32', reason="requires windows")
skip14 = pytest.mark.skipif(django.VERSION[0:2] == [1, 4], reason="skip django 1.4")
skip15 = pytest.mark.skipif(django.VERSION[0:2] == [1, 5], reason="skip django 1.4")
4 changes: 2 additions & 2 deletions tests/demo/base.py
Expand Up @@ -6,13 +6,13 @@
from django.contrib.auth.models import User, Group
from django_webtest import WebTestMixin
from .admin import admin_register_models
# from concurrency.api import apply_concurrency_check
from concurrency.api import apply_concurrency_check
from concurrency.fields import IntegerVersionField

SENTINEL = '**concurrent_update**'


# apply_concurrency_check(Group, 'version', IntegerVersionField)
apply_concurrency_check(Group, 'version', IntegerVersionField)

DJANGO_TRUNK = django.VERSION[:2] >= (1, 8)

Expand Down
13 changes: 10 additions & 3 deletions tests/test_base.py
@@ -1,5 +1,6 @@
import pytest
import django
from concurrency.api import apply_concurrency_check
import concurrency.config
from concurrency.core import _set_version
from concurrency.exceptions import RecordModifiedError
Expand All @@ -11,8 +12,16 @@
pytest.mark.django_db(transaction=False)


def pytest_generate_tests(metafunc):
if 'protocol' in metafunc.fixturenames:
if django.VERSION[1] in [4, 5]:
metafunc.parametrize("protocol", [1])
else:
metafunc.parametrize("protocol", [1, 2])


@with_all_models
@pytest.mark.parametrize("protocol", [1, 2])
# @pytest.mark.parametrize("protocol", [1, 2])
@pytest.mark.django_db
def test_standard_save(model_class, protocol, monkeypatch):
# this test pass if executed alone,
Expand All @@ -27,7 +36,6 @@ def test_standard_save(model_class, protocol, monkeypatch):

@pytest.mark.django_db(transaction=False)
@with_std_models
@pytest.mark.parametrize("protocol", [1, 2])
def test_conflict(model_class, protocol, monkeypatch):
monkeypatch.setattr(concurrency.config.conf, 'PROTOCOL', protocol)

Expand Down Expand Up @@ -62,4 +70,3 @@ def test_do_not_check_if_no_version(model_class):
instance.save()
assert instance.get_concurrency_version() > 0
assert instance.get_concurrency_version() != copy.get_concurrency_version()

0 comments on commit 366694a

Please sign in to comment.