Merge ~pappacena/turnip:py3-http-auth-testfix into turnip:master

Proposed by Thiago F. Pappacena
Status: Merged
Approved by: Thiago F. Pappacena
Approved revision: 3f2af8747db9e37a76bd6110ded448835e9b2cd3
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~pappacena/turnip:py3-http-auth-testfix
Merge into: turnip:master
Prerequisite: ~pappacena/turnip:py3-repo-creation-check
Diff against target: 96 lines (+18/-37)
2 files modified
Makefile (+10/-29)
turnip/pack/tests/test_functional.py (+8/-8)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+394375@code.launchpad.net

Commit message

Fixing HTTP auth tests and reorganizing python3 test runner

Description of the change

This MP fixes the last tests incompatible with py3, and reorganizes the Makefile so that `make test` (and `make check`) always run tests on both python2 and python3.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
Otto Co-Pilot (otto-copilot) wrote :
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

11:08:35 E: fatal: unable to access 'https://git.launchpad.net/~canonical-launchpad-branches/turnip/+git/dependencies/': Operation timed out after 300016 milliseconds with 0 out of 0 bytes received

That's odd. Let's try again, Jenkins...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index a47e5aa..0b9d1b1 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -70,9 +70,17 @@ bootstrap-test:
6 -sudo rabbitmqctl add_vhost turnip-test-vhost
7 -sudo rabbitmqctl set_permissions -p "turnip-test-vhost" "guest" ".*" ".*" ".*"
8
9-test: $(ENV) bootstrap-test
10+run-test: $(ENV) bootstrap-test
11 $(PYTHON) -m unittest discover $(ARGS) turnip
12
13+test: test-python2 test-python3
14+
15+test-python2:
16+ $(MAKE) run-test VENV_ARGS="-p python2"
17+
18+test-python3:
19+ $(MAKE) run-test VENV_ARGS="-p python3" ENV="$(PY3_ENV)"
20+
21 clean:
22 find turnip -name '*.py[co]' -exec rm '{}' \;
23 rm -rf $(ENV) $(PY3_ENV) $(PIP_CACHE)
24@@ -94,34 +102,7 @@ lint: $(ENV)
25 pip-check: $(ENV)
26 $(PIP) check
27
28-check: pip-check test lint check-python3-partial
29-
30-# This rule should be removed once all tests are running in python3.
31-# Meanwhile, let's keep this list up-to-date and make sure we won't have
32-# regressions.
33-check-python3-partial:
34- $(MAKE) build VENV_ARGS="-p python3" ENV="$(PY3_ENV)"
35- # XXX: Tests not passing on python3 yet:
36- # turnip.pack.tests.test_functional.TestSmartHTTPFrontendWithAuthFunctional
37- $(PY3_ENV)/bin/python -m unittest \
38- turnip.api.tests.test_api \
39- turnip.api.tests.test_helpers \
40- turnip.api.tests.test_store \
41- turnip.pack.tests.test_git \
42- turnip.pack.tests.test_helpers \
43- turnip.pack.tests.test_hookrpc \
44- turnip.pack.tests.test_hooks \
45- turnip.pack.tests.test_http \
46- turnip.pack.tests.test_ssh \
47- turnip.pack.tests.test_functional.TestBackendFunctional \
48- turnip.pack.tests.test_functional.TestGitFrontendFunctional \
49- turnip.pack.tests.test_functional.TestSmartSSHServiceFunctional \
50- turnip.pack.tests.test_functional.TestSmartHTTPFrontendFunctional
51-
52-check-python3:
53- $(MAKE) check VENV_ARGS="-p python3" ENV="$(PY3_ENV)"
54-
55-check-python-compat: check check-python3
56+check: pip-check test lint
57
58 run-api: $(ENV)
59 $(PSERVE) api.ini --reload
60diff --git a/turnip/pack/tests/test_functional.py b/turnip/pack/tests/test_functional.py
61index eb52f62..dedaeb5 100644
62--- a/turnip/pack/tests/test_functional.py
63+++ b/turnip/pack/tests/test_functional.py
64@@ -887,16 +887,16 @@ class TestSmartHTTPFrontendWithAuthFunctional(TestSmartHTTPFrontendFunctional):
65 yield self.assertCommandSuccess((b'git', b'clone', self.ro_url, clone))
66 expected_requests = 1 if self.protocol_version in (b'0', b'1') else 2
67 self.assertEqual(
68- [(b'test-user', b'test-password')] * expected_requests,
69+ [('test-user', 'test-password')] * expected_requests,
70 self.virtinfo.authentications)
71 self.assertEqual(expected_requests, len(self.virtinfo.translations))
72 for translation in self.virtinfo.translations:
73 self.assertThat(translation, MatchesListwise([
74- Equals(b'/test'), Equals(b'read'),
75+ Equals('/test'), Equals('read'),
76 MatchesDict({
77- b'can-authenticate': Is(True),
78- b'request-id': Not(Is(None)),
79- b'user': Equals(b'test-user')})
80+ 'can-authenticate': Is(True),
81+ 'request-id': Not(Is(None)),
82+ 'user': Equals('test-user')})
83 ]))
84
85 @defer.inlineCallbacks
86@@ -919,9 +919,9 @@ class TestSmartHTTPFrontendWithAuthFunctional(TestSmartHTTPFrontendFunctional):
87 Equals(self.internal_name),
88 Equals([b'refs/heads/master']),
89 MatchesDict({
90- b'can-authenticate': Is(True),
91- b'request-id': Not(Is(None)),
92- b'user': Equals(b'test-user'),
93+ 'can-authenticate': Is(True),
94+ 'request-id': Not(Is(None)),
95+ 'user': Equals('test-user'),
96 })])]))
97
98

Subscribers

People subscribed via source and target branches