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

feat: upgrade #47

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,38 @@ env:

- TOX_ENV=flake8

- TOX_ENV=py38-django4.2
- TOX_ENV=py38-django4.1
- TOX_ENV=py38-django4.0
- TOX_ENV=py38-django3.2
- TOX_ENV=py38-django3.1
- TOX_ENV=py38-django3.0

- TOX_ENV=py37-django4.2
- TOX_ENV=py37-django4.1
- TOX_ENV=py37-django4.0
- TOX_ENV=py37-django3.2
- TOX_ENV=py37-django3.1
- TOX_ENV=py37-django3.0
- TOX_ENV=py37-django2.2
- TOX_ENV=py37-django2.1
- TOX_ENV=py37-django2.0

- TOX_ENV=py36-django2.2
- TOX_ENV=py36-django2.1
- TOX_ENV=py36-django2.0
- TOX_ENV=py36-django1.11

- TOX_ENV=py35-django2.2
- TOX_ENV=py35-django2.1
- TOX_ENV=py35-django2.0
- TOX_ENV=py35-django1.11
- TOX_ENV=py35-django1.10
- TOX_ENV=py35-django1.9

- TOX_ENV=py34-django2.0
- TOX_ENV=py34-django1.11
- TOX_ENV=py34-django1.10
- TOX_ENV=py34-django1.9
- TOX_ENV=py34-django1.8
- TOX_ENV=py34-django1.7
Expand All @@ -14,12 +46,16 @@ env:
- TOX_ENV=py33-django1.7
- TOX_ENV=py33-django1.6
- TOX_ENV=py33-django1.5
- TOX_ENV=py33-django1.4

- TOX_ENV=py32-django1.8
- TOX_ENV=py32-django1.7
- TOX_ENV=py32-django1.6
- TOX_ENV=py32-django1.5
- TOX_ENV=py32-django1.4

- TOX_ENV=py27-django1.11
- TOX_ENV=py27-django1.10
- TOX_ENV=py27-django1.9
- TOX_ENV=py27-django1.8
- TOX_ENV=py27-django1.7
Expand Down
10 changes: 5 additions & 5 deletions tests/mock_django/managers/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ManagerMockTestCase(TestCase):
def test_iter(self):
manager = make_manager()
inst = ManagerMock(manager, 'foo')
self.assertEquals(list(inst.all()), ['foo'])
self.assertEqual(list(inst.all()), ['foo'])

def test_iter_exception(self):
manager = make_manager()
Expand All @@ -38,18 +38,18 @@ def test_iter_exception(self):
def test_getitem(self):
manager = make_manager()
inst = ManagerMock(manager, 'foo')
self.assertEquals(inst.all()[0], 'foo')
self.assertEqual(inst.all()[0], 'foo')

def test_returns_self(self):
manager = make_manager()
inst = ManagerMock(manager, 'foo')
self.assertEquals(inst.all(), inst)
self.assertEqual(inst.all(), inst)

def test_get_on_singular_list(self):
manager = make_manager()
inst = ManagerMock(manager, 'foo')

self.assertEquals(inst.get(), 'foo')
self.assertEqual(inst.get(), 'foo')

def test_get_on_multiple_objects(self):
manager = make_manager()
Expand Down Expand Up @@ -81,7 +81,7 @@ def test_call_tracking(self):
def test_getitem_get(self):
manager = make_manager()
inst = ManagerMock(manager, 'foo')
self.assertEquals(inst[0:1].get(), 'foo')
self.assertEqual(inst[0:1].get(), 'foo')

def test_get_raises_doesnotexist_with_queryset(self):
manager = make_manager()
Expand Down
4 changes: 2 additions & 2 deletions tests/mock_django/models/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def bar(self):
class ModelMockTestCase(TestCase):
def test_pk_alias(self):
mock = ModelMock(Model)
self.assertEquals(mock.id, mock.pk)
self.assertEqual(mock.id, mock.pk)

def test_only_model_attrs_exist(self):
"""
Expand All @@ -36,7 +36,7 @@ def test_model_attrs_are_mocks(self):
ModelMock members are Mocks, not the actual model members.
"""
mock = ModelMock(Model)
self.assertNotEquals(mock.bar(), 'bar')
self.assertNotEqual(mock.bar(), 'bar')
self.assertIsInstance(mock, MagicMock)

def test_attrs_are_not_identical(self):
Expand Down
12 changes: 6 additions & 6 deletions tests/mock_django/query/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@ def bar(self):
class QuerySetTestCase(TestCase):
def test_vals_returned(self):
qs = QuerySetMock(None, 1, 2, 3)
self.assertEquals(list(qs), [1, 2, 3])
self.assertEqual(list(qs), [1, 2, 3])

def test_qs_generator_inequality(self):
"""
Each QuerySet-returning method's return value is unique.
"""
qs = QuerySetMock(None, 1, 2, 3)
self.assertNotEquals(qs.all(), qs.filter())
self.assertNotEquals(qs.filter(), qs.order_by())
self.assertNotEqual(qs.all(), qs.filter())
self.assertNotEqual(qs.filter(), qs.order_by())

def test_qs_yield_equality(self):
"""
The generators may not be the same, but they do produce the same output.
"""
qs = QuerySetMock(None, 1, 2, 3)
self.assertEquals(list(qs.all()), list(qs.filter()))
self.assertEqual(list(qs.all()), list(qs.filter()))

def test_qs_method_takes_arg(self):
"""
QS-returning methods are impotent, but they do take args.
"""
qs = QuerySetMock(None, 1, 2, 3)
self.assertEquals(list(qs.order_by('something')), [1, 2, 3])
self.assertEqual(list(qs.order_by('something')), [1, 2, 3])

def test_raises_exception_when_evaluated(self):
"""
Expand Down Expand Up @@ -80,7 +80,7 @@ def test_chained_calls_return_new_querysetmocks(self):
# Test reserved methods
def test_count_is_scalar(self):
qs = QuerySetMock(None, 1, 2, 3)
self.assertEquals(qs.count(), 3)
self.assertEqual(qs.count(), 3)

def test_exists_is_boolean(self):
qs = QuerySetMock(None)
Expand Down
32 changes: 26 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,27 @@

[tox]
envlist =
py34-django{1.9,1.8,1.7,1.6,1.5},
py27-django{1.9,1.8,1.7,1.6,1.5,1.4},
py26-django{1.6,1.5,1.4},
py38-django{4.2, 4.1, 4.0, 3.2, 3.1, 3.0},
py37-django{3.2, 3.1, 3.0, 2.2, 2.1, 2.0},
py36-django{3.2, 3.1, 3.0, 2.2, 2.1, 2.0, 1.11},
py35-django{2.2, 2.1, 2.0, 1.11, 1.10, 1.9},
py34-django{2.0, 1.11, 1.10, 1.9, 1.8, 1.7, 1.6, 1.5},
py33-django{1.8, 1.7, 1.6, 1.5, 1.4},
py32-django{1.8, 1.7, 1.6, 1.5, 1.4},
py27-django{1.11, 1.10, 1.9, 1.8, 1.7, 1.6, 1.5, 1.4},
py26-django{1.6, 1.5, 1.4},
flake8

[testenv]
commands = {envpython} runtests.py
basepython =
py38: python3.8
py37: python3.7
py36: python3.6
py35: python3.5
py34: python3.4
py33: python3.4
py32: python3.4
py33: python3.3
py32: python3.2
py27: python2.7
py26: python2.6
pypy: pypy
Expand All @@ -27,7 +36,18 @@ deps =
django1.6: Django==1.6
django1.7: Django==1.7
django1.8: Django==1.8
django1.9: Django==1.9a1
django1.9: Django==1.9
django1.10: Django==1.10
django1.11: Django==1.11
django2.0: Django==2.0
django2.1: Django==2.1
django2.2: Django==2.2
django3.0: Django==3.0
django3.1: Django==3.1
django3.2: Django==3.2
django4.0: Django==4.0
djagno4.1: Django==4.1
django4.2: Django==4.2
-r{toxinidir}/tests/requirements.txt

[testenv:flake8]
Expand Down