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
diff --git a/Makefile b/Makefile
index a47e5aa..0b9d1b1 100644
--- a/Makefile
+++ b/Makefile
@@ -70,9 +70,17 @@ bootstrap-test:
70 -sudo rabbitmqctl add_vhost turnip-test-vhost70 -sudo rabbitmqctl add_vhost turnip-test-vhost
71 -sudo rabbitmqctl set_permissions -p "turnip-test-vhost" "guest" ".*" ".*" ".*"71 -sudo rabbitmqctl set_permissions -p "turnip-test-vhost" "guest" ".*" ".*" ".*"
7272
73test: $(ENV) bootstrap-test73run-test: $(ENV) bootstrap-test
74 $(PYTHON) -m unittest discover $(ARGS) turnip74 $(PYTHON) -m unittest discover $(ARGS) turnip
7575
76test: test-python2 test-python3
77
78test-python2:
79 $(MAKE) run-test VENV_ARGS="-p python2"
80
81test-python3:
82 $(MAKE) run-test VENV_ARGS="-p python3" ENV="$(PY3_ENV)"
83
76clean:84clean:
77 find turnip -name '*.py[co]' -exec rm '{}' \;85 find turnip -name '*.py[co]' -exec rm '{}' \;
78 rm -rf $(ENV) $(PY3_ENV) $(PIP_CACHE)86 rm -rf $(ENV) $(PY3_ENV) $(PIP_CACHE)
@@ -94,34 +102,7 @@ lint: $(ENV)
94pip-check: $(ENV)102pip-check: $(ENV)
95 $(PIP) check103 $(PIP) check
96104
97check: pip-check test lint check-python3-partial105check: pip-check test lint
98
99# This rule should be removed once all tests are running in python3.
100# Meanwhile, let's keep this list up-to-date and make sure we won't have
101# regressions.
102check-python3-partial:
103 $(MAKE) build VENV_ARGS="-p python3" ENV="$(PY3_ENV)"
104 # XXX: Tests not passing on python3 yet:
105 # turnip.pack.tests.test_functional.TestSmartHTTPFrontendWithAuthFunctional
106 $(PY3_ENV)/bin/python -m unittest \
107 turnip.api.tests.test_api \
108 turnip.api.tests.test_helpers \
109 turnip.api.tests.test_store \
110 turnip.pack.tests.test_git \
111 turnip.pack.tests.test_helpers \
112 turnip.pack.tests.test_hookrpc \
113 turnip.pack.tests.test_hooks \
114 turnip.pack.tests.test_http \
115 turnip.pack.tests.test_ssh \
116 turnip.pack.tests.test_functional.TestBackendFunctional \
117 turnip.pack.tests.test_functional.TestGitFrontendFunctional \
118 turnip.pack.tests.test_functional.TestSmartSSHServiceFunctional \
119 turnip.pack.tests.test_functional.TestSmartHTTPFrontendFunctional
120
121check-python3:
122 $(MAKE) check VENV_ARGS="-p python3" ENV="$(PY3_ENV)"
123
124check-python-compat: check check-python3
125106
126run-api: $(ENV)107run-api: $(ENV)
127 $(PSERVE) api.ini --reload108 $(PSERVE) api.ini --reload
diff --git a/turnip/pack/tests/test_functional.py b/turnip/pack/tests/test_functional.py
index eb52f62..dedaeb5 100644
--- a/turnip/pack/tests/test_functional.py
+++ b/turnip/pack/tests/test_functional.py
@@ -887,16 +887,16 @@ class TestSmartHTTPFrontendWithAuthFunctional(TestSmartHTTPFrontendFunctional):
887 yield self.assertCommandSuccess((b'git', b'clone', self.ro_url, clone))887 yield self.assertCommandSuccess((b'git', b'clone', self.ro_url, clone))
888 expected_requests = 1 if self.protocol_version in (b'0', b'1') else 2888 expected_requests = 1 if self.protocol_version in (b'0', b'1') else 2
889 self.assertEqual(889 self.assertEqual(
890 [(b'test-user', b'test-password')] * expected_requests,890 [('test-user', 'test-password')] * expected_requests,
891 self.virtinfo.authentications)891 self.virtinfo.authentications)
892 self.assertEqual(expected_requests, len(self.virtinfo.translations))892 self.assertEqual(expected_requests, len(self.virtinfo.translations))
893 for translation in self.virtinfo.translations:893 for translation in self.virtinfo.translations:
894 self.assertThat(translation, MatchesListwise([894 self.assertThat(translation, MatchesListwise([
895 Equals(b'/test'), Equals(b'read'),895 Equals('/test'), Equals('read'),
896 MatchesDict({896 MatchesDict({
897 b'can-authenticate': Is(True),897 'can-authenticate': Is(True),
898 b'request-id': Not(Is(None)),898 'request-id': Not(Is(None)),
899 b'user': Equals(b'test-user')})899 'user': Equals('test-user')})
900 ]))900 ]))
901901
902 @defer.inlineCallbacks902 @defer.inlineCallbacks
@@ -919,9 +919,9 @@ class TestSmartHTTPFrontendWithAuthFunctional(TestSmartHTTPFrontendFunctional):
919 Equals(self.internal_name),919 Equals(self.internal_name),
920 Equals([b'refs/heads/master']),920 Equals([b'refs/heads/master']),
921 MatchesDict({921 MatchesDict({
922 b'can-authenticate': Is(True),922 'can-authenticate': Is(True),
923 b'request-id': Not(Is(None)),923 'request-id': Not(Is(None)),
924 b'user': Equals(b'test-user'),924 'user': Equals('test-user'),
925 })])]))925 })])]))
926926
927927

Subscribers

People subscribed via source and target branches