Merge lp:~ricardokirkner/pkgme-service/run-click-checks-using-pythonpath into lp:pkgme-service

Proposed by Ricardo Kirkner
Status: Merged
Approved by: Ricardo Kirkner
Approved revision: 228
Merged at revision: 228
Proposed branch: lp:~ricardokirkner/pkgme-service/run-click-checks-using-pythonpath
Merge into: lp:pkgme-service
Diff against target: 87 lines (+20/-7)
3 files modified
django_project/settings_base.py (+2/-1)
src/djpkgme/tasks.py (+4/-1)
src/djpkgme/tests/test_tasks.py (+14/-5)
To merge this branch: bzr merge lp:~ricardokirkner/pkgme-service/run-click-checks-using-pythonpath
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+261133@code.launchpad.net

Commit message

ensure PYTHONPATH is properly set to allow click checks to run

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'django_project/settings_base.py'
2--- django_project/settings_base.py 2014-11-25 19:44:16 +0000
3+++ django_project/settings_base.py 2015-06-04 18:57:08 +0000
4@@ -19,7 +19,8 @@
5 }
6 CELERY_DISABLE_RATE_LIMITS = True
7 CELERYD_TASK_TIME_LIMIT = 120
8-CLICK_REVIEWERS_TOOLS_BIN_PATH = 'branches/click-reviewers-tools/bin'
9+CLICK_REVIEWERS_TOOLS_BASE_PATH = 'branches/click-reviewers-tools'
10+CLICK_REVIEWERS_TOOLS_BIN_PATH = CLICK_REVIEWERS_TOOLS_BASE_PATH + '/bin'
11 DATABASES = {
12 'default': {
13 'ENGINE': 'django.db.backends.sqlite3',
14
15=== modified file 'src/djpkgme/tasks.py'
16--- src/djpkgme/tasks.py 2015-05-13 10:38:33 +0000
17+++ src/djpkgme/tasks.py 2015-06-04 18:57:08 +0000
18@@ -522,7 +522,10 @@
19 cmd = [script_path, package_path]
20 if overrides is not None:
21 cmd.append(json.dumps(overrides))
22- cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
23+ cmd_output = subprocess.check_output(
24+ cmd,
25+ env={'PYTHONPATH': settings.CLICK_REVIEWERS_TOOLS_BASE_PATH},
26+ stderr=subprocess.STDOUT)
27 except subprocess.CalledProcessError as e:
28 cmd_output = e.output
29
30
31=== modified file 'src/djpkgme/tests/test_tasks.py'
32--- src/djpkgme/tests/test_tasks.py 2015-04-15 19:54:25 +0000
33+++ src/djpkgme/tests/test_tasks.py 2015-06-04 18:57:08 +0000
34@@ -1227,7 +1227,9 @@
35 script_path = os.path.join(settings.CLICK_REVIEWERS_TOOLS_BIN_PATH,
36 check_name)
37 mock_call.assert_called_with(
38- [script_path, package_path], stderr=subprocess.STDOUT)
39+ [script_path, package_path],
40+ env={'PYTHONPATH': settings.CLICK_REVIEWERS_TOOLS_BASE_PATH},
41+ stderr=subprocess.STDOUT)
42
43 @patch('djpkgme.tasks.subprocess.check_output')
44 def test_run_click_check_fails(self, mock_call):
45@@ -1251,7 +1253,9 @@
46 script_path = os.path.join(settings.CLICK_REVIEWERS_TOOLS_BIN_PATH,
47 check_name)
48 mock_call.assert_called_with(
49- [script_path, package_path], stderr=subprocess.STDOUT)
50+ [script_path, package_path],
51+ env={'PYTHONPATH': settings.CLICK_REVIEWERS_TOOLS_BASE_PATH},
52+ stderr=subprocess.STDOUT)
53
54 @patch('djpkgme.tasks.subprocess.check_output')
55 def test_run_click_check_fails_output_not_json(self, mock_call):
56@@ -1281,7 +1285,9 @@
57 script_path = os.path.join(settings.CLICK_REVIEWERS_TOOLS_BIN_PATH,
58 check_name)
59 mock_call.assert_called_with(
60- [script_path, package_path], stderr=subprocess.STDOUT)
61+ [script_path, package_path],
62+ env={'PYTHONPATH': settings.CLICK_REVIEWERS_TOOLS_BASE_PATH},
63+ stderr=subprocess.STDOUT)
64
65 @patch('djpkgme.tasks.subprocess.check_output')
66 def test_run_click_checks(self, mock_check_output):
67@@ -1305,7 +1311,9 @@
68 script_path = os.path.join(
69 settings.CLICK_REVIEWERS_TOOLS_BIN_PATH, check)
70 cmd = [script_path, package_path, '{"framework": {}}']
71- mock_check_output.assert_any_call(cmd, stderr=subprocess.STDOUT)
72+ env = {'PYTHONPATH': settings.CLICK_REVIEWERS_TOOLS_BASE_PATH}
73+ mock_check_output.assert_any_call(
74+ cmd, env=env, stderr=subprocess.STDOUT)
75
76 def test_get_click_reviewers_tools_revno(self):
77 job = ClickPackageReviewJob()
78@@ -1417,7 +1425,8 @@
79 script_path = os.path.join(settings.CLICK_REVIEWERS_TOOLS_BIN_PATH,
80 check_name)
81 cmd = [script_path, downloaded_path, '{"framework": {}}']
82- mock_call.assert_any_call(cmd, stderr=subprocess.STDOUT)
83+ env = {'PYTHONPATH': settings.CLICK_REVIEWERS_TOOLS_BASE_PATH}
84+ mock_call.assert_any_call(cmd, env=env, stderr=subprocess.STDOUT)
85 self.assertEqual(3, len(results.keys()))
86 # there should be 4 successful checks:
87 # - valid click package

Subscribers

People subscribed via source and target branches