Merge lp:~ricardokirkner/ols-tests-django/support-django-1.10 into lp:ols-tests-django

Proposed by Ricardo Kirkner
Status: Merged
Approved by: Ricardo Kirkner
Approved revision: 27
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: lp:~ricardokirkner/ols-tests-django/support-django-1.10
Merge into: lp:ols-tests-django
Diff against target: 117 lines (+45/-4)
4 files modified
olstestsdjango/runner.py (+5/-1)
olstestsdjango/tests/test_runner.py (+18/-1)
setup.py (+1/-1)
tox.ini (+21/-1)
To merge this branch: bzr merge lp:~ricardokirkner/ols-tests-django/support-django-1.10
Reviewer Review Type Date Requested Status
Vincent Ladeuil (community) Approve
Review via email: mp+322142@code.launchpad.net

Commit message

return different results from setup_databases depending on django version

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Small nit but excellent work otherwise, thanks !

Approving assuming you agree with the nit so you can land otherwise, let's talk ;-)

Ha hmm, almost there, running tox (as ci will d) fails:

ERROR: py2.7-django-1.11: commands failed

ImportError: No module named django

Makefile:8: recipe for target 'test' failed
make: *** [test] Error 1
ERROR: InvocationError: '/usr/bin/make test'

review: Approve
Revision history for this message
Otto Co-Pilot (otto-copilot) wrote :
26. By Ricardo Kirkner

fixed syntax for old tox 1.6.0 (used in CI)

27. By Ricardo Kirkner

bump version

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'olstestsdjango/runner.py'
2--- olstestsdjango/runner.py 2016-06-09 12:31:32 +0000
3+++ olstestsdjango/runner.py 2017-04-07 13:55:21 +0000
4@@ -14,6 +14,7 @@
5
6
7 with_argparse = django.VERSION[0:2] >= (1, 8)
8+setup_databases_returns_mirrors = django.VERSION[0:2] < (1, 9)
9
10
11 def set_trace():
12@@ -138,7 +139,10 @@
13 """
14 # Return an empty but valid value so teardown_databases does nothing
15 # when invoked from the base class run_suite().
16- return ([], [])
17+ if setup_databases_returns_mirrors:
18+ return ([], [])
19+ else:
20+ return []
21
22 def build_suite(self, test_labels=None, extra_tests=None, **kwargs):
23 if not test_labels:
24
25=== modified file 'olstestsdjango/tests/test_runner.py'
26--- olstestsdjango/tests/test_runner.py 2016-06-09 12:31:32 +0000
27+++ olstestsdjango/tests/test_runner.py 2017-04-07 13:55:21 +0000
28@@ -4,7 +4,7 @@
29 import unittest
30 from cStringIO import StringIO
31
32-
33+import django
34 from django.core import management
35 from olstests import (
36 filters,
37@@ -121,6 +121,23 @@
38 self.run_test(['--pick', '1/2'])
39 self.assertEqual([1, 2], self.runner.pick)
40
41+ @unittest.skipIf(runner.setup_databases_returns_mirrors,
42+ 'Test is not compatible with django 1.8 or earlier')
43+ def test_setup_databases_when_setup_does_not_return_mirrors(self):
44+ old_config = runner.TestRunner().setup_databases()
45+ self.assertEqual(old_config, [])
46+
47+ @unittest.skipUnless(runner.setup_databases_returns_mirrors,
48+ 'Test is not compatible with django 1.9 or later')
49+ def test_setup_databases_when_setup_returns_mirrors(self):
50+ old_config = runner.TestRunner().setup_databases()
51+ self.assertEqual(old_config, ([], []))
52+
53+ def test_setup_databases_returns_mirrors(self):
54+ self.assertEqual(
55+ runner.setup_databases_returns_mirrors,
56+ django.VERSION[0:2] < (1, 9))
57+
58
59 class TestBuildSuite(unittest.TestCase):
60
61
62=== modified file 'setup.py'
63--- setup.py 2016-01-07 13:04:45 +0000
64+++ setup.py 2017-04-07 13:55:21 +0000
65@@ -6,7 +6,7 @@
66
67 setuptools.setup(
68 name='ols-tests-django',
69- version='0.0.1',
70+ version='0.0.2',
71 license='GPLv3',
72 description='Online Services django test modules',
73 author='Vincent Ladeuil',
74
75=== modified file 'tox.ini'
76--- tox.ini 2016-05-12 13:38:23 +0000
77+++ tox.ini 2017-04-07 13:55:21 +0000
78@@ -1,7 +1,9 @@
79 [tox]
80 envlist =
81- py2.7-django1.6, py2.7-django1.7, py2.7-django1.8, py2.7-django1.9,
82+ py2.7-django1.6, py2.7-django1.7, py2.7-django1.8, py2.7-django1.9, py2.7-django1.10, py2.7-django1.11,
83+ py3-django1.11,
84 pay-precise, sca-trusty, sso-trusty
85+
86 [testenv]
87 basepython = python2.7
88 commands = make test
89@@ -35,6 +37,16 @@
90 django >= 1.9, < 1.10
91 {[testenv]deps}
92
93+[testenv:py2.7-django1.10]
94+deps =
95+ django >= 1.10, < 1.11
96+ {[testenv]deps}
97+
98+[testenv:py2.7-django1.11]
99+deps =
100+ django >= 1.11, < 1.12
101+ {[testenv]deps}
102+
103 [testenv:pay-precise]
104 deps =
105 django >= 1.6, < 1.7
106@@ -56,3 +68,11 @@
107 {[testenv]deps}
108 testtools==0.9.34
109 python-subunit==1.1.0
110+
111+[testenv:py3]
112+basepython = python3
113+
114+[testenv:py3-django1.11]
115+deps =
116+ django >= 1.11, < 1.12
117+ {[testenv]deps}

Subscribers

People subscribed via source and target branches