Merge lp:~cjwatson/click/fix-tests-installation into lp:click

Proposed by Colin Watson
Status: Superseded
Proposed branch: lp:~cjwatson/click/fix-tests-installation
Merge into: lp:click
Diff against target: 125 lines (+20/-10)
7 files modified
click/tests/integration/helpers.py (+2/-1)
click/tests/integration/test_build_core_apps.py (+3/-4)
click/tests/integration/test_hook.py (+2/-2)
debian/changelog (+10/-0)
debian/control (+1/-1)
debian/tests/control (+1/-1)
debian/tests/run-tests.sh (+1/-1)
To merge this branch: bzr merge lp:~cjwatson/click/fix-tests-installation
Reviewer Review Type Date Requested Status
click hackers Pending
Review via email: mp+226075@code.launchpad.net

This proposal has been superseded by a proposal from 2014-07-09.

Commit message

Move integration tests to a location where they won't end up being installed into inappropriate places on the system module path (LP: #1337696).

Description of the change

The integration tests are being installed to /usr/lib/python3/dist-packages/tests/, which is clearly wrong. I moved them into click.tests to fix this, and put some additional arrangements in place so that they aren't run as part of unit tests.

This made the integration tests visible to pyflakes/pep8, which necessitated some follow-up tweaks.

To post a comment you must log in.
494. By Colin Watson

Hack around unittest.skipIf decorator ordering, which caused some bits of the integration test framework to try to run without sufficient dependencies installed.

495. By Colin Watson

Don't fail if ping does not exist (as when running the unit tests in an environment without sufficient dependencies to run the integration tests).

496. By Colin Watson

merge trunk

497. By Colin Watson

More PEP-8 failures.

498. By Colin Watson

Call skipTest in ClickTestCase.setUp rather than using allow_integration helper everywhere.

499. By Colin Watson

Use is_root helper in another place.

500. By Colin Watson

Rearrange integration test skip logic to do everything in setUpClass rather than via decorators, for clarity of ordering.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed directory 'tests/integration' => 'click/tests/integration'
2=== modified file 'click/tests/integration/helpers.py'
3--- tests/integration/helpers.py 2014-07-03 12:55:50 +0000
4+++ click/tests/integration/helpers.py 2014-07-09 08:28:28 +0000
5@@ -22,7 +22,6 @@
6 import random
7 import shutil
8 import string
9-import shutil
10 import subprocess
11 import tempfile
12 import unittest
13@@ -46,6 +45,8 @@
14 os.chdir(curdir)
15
16
17+@unittest.skipUnless(
18+ "TEST_INTEGRATION" in os.environ, "Skipping integration tests")
19 class ClickTestCase(unittest.TestCase):
20
21 @classmethod
22
23=== modified file 'click/tests/integration/test_build_core_apps.py'
24--- tests/integration/test_build_core_apps.py 2014-07-02 18:21:32 +0000
25+++ click/tests/integration/test_build_core_apps.py 2014-07-09 08:28:28 +0000
26@@ -22,6 +22,8 @@
27 import subprocess
28 import unittest
29
30+from six import with_metaclass
31+
32 from .helpers import (
33 chdir,
34 has_network,
35@@ -65,7 +67,7 @@
36
37 @unittest.skipIf(not is_root(), "This tests needs to run as root")
38 @unittest.skipIf(not has_network(), "Need network")
39-class TestBuildCoreApps(ClickTestCase, metaclass=AddBranchTestFunctions):
40+class TestBuildCoreApps(with_metaclass(AddBranchTestFunctions, ClickTestCase)):
41
42 def _run_in_chroot(self, cmd):
43 """Run the given cmd in a click chroot"""
44@@ -117,6 +119,3 @@
45 self.configure()
46 self.make()
47 self.create_click()
48-
49-
50-
51
52=== modified file 'click/tests/integration/test_hook.py'
53--- tests/integration/test_hook.py 2014-07-04 14:35:59 +0000
54+++ click/tests/integration/test_hook.py 2014-07-09 08:28:28 +0000
55@@ -55,7 +55,7 @@
56 subprocess.check_call(
57 [self.click_binary, "hook", "install", hook_name])
58 self.addCleanup(
59- subprocess.check_call, [self.click_binary, "hook", "remove",
60+ subprocess.check_call, [self.click_binary, "hook", "remove",
61 hook_name])
62 # make click that uses the hook
63 hooks = {'app1' : {hook_name: 'README'}}
64@@ -67,7 +67,7 @@
65 self.click_binary, "install", "--user=%s" % user, click_pkg],
66 universal_newlines=True)
67 self.addCleanup(
68- subprocess.check_call,
69+ subprocess.check_call,
70 [self.click_binary, "unregister","--user=%s" % user,
71 click_pkg_name])
72 # ensure we have the hook
73
74=== modified file 'debian/changelog'
75--- debian/changelog 2014-07-04 15:10:01 +0000
76+++ debian/changelog 2014-07-09 08:28:28 +0000
77@@ -1,3 +1,13 @@
78+click (0.4.30) UNRELEASED; urgency=medium
79+
80+ * Move integration tests to a location where they won't end up being
81+ installed into inappropriate places on the system module path
82+ (LP: #1337696).
83+ * Use six.with_metaclass for TestBuildCoreApps, so that it doesn't make
84+ pyflakes angry when running tests under Python 2.
85+
86+ -- Colin Watson <cjwatson@ubuntu.com> Tue, 08 Jul 2014 12:58:05 +0100
87+
88 click (0.4.29.1) utopic; urgency=medium
89
90 [ Michael Vogt ]
91
92=== modified file 'debian/control'
93--- debian/control 2014-06-10 17:18:00 +0000
94+++ debian/control 2014-07-09 08:28:28 +0000
95@@ -3,7 +3,7 @@
96 Priority: optional
97 Maintainer: Colin Watson <cjwatson@ubuntu.com>
98 Standards-Version: 3.9.5
99-Build-Depends: debhelper (>= 9~), dh-autoreconf, intltool, python3:any (>= 3.2), python3-all:any, python3-setuptools, python3-apt, python3-debian, python3-gi, python3:any (>= 3.3) | python3-mock, pep8, python3-pep8, pyflakes, python3-sphinx, pkg-config, valac, gobject-introspection (>= 0.6.7), libgirepository1.0-dev (>= 0.6.7), libglib2.0-dev (>= 2.34), gir1.2-glib-2.0, libjson-glib-dev (>= 0.10), libgee-0.8-dev, libpackagekit-glib2-dev (>= 0.7.2), python3-coverage
100+Build-Depends: debhelper (>= 9~), dh-autoreconf, intltool, python3:any (>= 3.2), python3-all:any, python3-setuptools, python3-apt, python3-debian, python3-gi, python3:any (>= 3.3) | python3-mock, pep8, python3-pep8, pyflakes, python3-sphinx, pkg-config, valac, gobject-introspection (>= 0.6.7), libgirepository1.0-dev (>= 0.6.7), libglib2.0-dev (>= 2.34), gir1.2-glib-2.0, libjson-glib-dev (>= 0.10), libgee-0.8-dev, libpackagekit-glib2-dev (>= 0.7.2), python3-coverage, python3-six
101 Vcs-Bzr: https://code.launchpad.net/~ubuntu-managed-branches/click/click
102 Vcs-Browser: http://bazaar.launchpad.net/~ubuntu-managed-branches/click/click/files
103 X-Auto-Uploader: no-rewrite-version
104
105=== modified file 'debian/tests/control'
106--- debian/tests/control 2014-06-30 14:03:36 +0000
107+++ debian/tests/control 2014-07-09 08:28:28 +0000
108@@ -1,3 +1,3 @@
109 Tests: run-tests.sh
110-Depends: @, iputils-ping, click-dev, schroot, debootstrap, sudo, bzr
111+Depends: @, iputils-ping, click-dev, schroot, debootstrap, sudo, bzr, python3-six
112 Restrictions: needs-root allow-stderr
113
114=== modified file 'debian/tests/run-tests.sh'
115--- debian/tests/run-tests.sh 2014-06-11 12:40:44 +0000
116+++ debian/tests/run-tests.sh 2014-07-09 08:28:28 +0000
117@@ -2,4 +2,4 @@
118
119 set -e
120
121-python3 -m unittest discover tests.integration
122+TEST_INTEGRATION=1 python3 -m unittest discover -vv click.tests.integration
123
124=== removed directory 'tests'
125=== removed file 'tests/__init__.py'

Subscribers

People subscribed via source and target branches

to all changes: