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
=== renamed directory 'tests/integration' => 'click/tests/integration'
=== modified file 'click/tests/integration/helpers.py'
--- tests/integration/helpers.py 2014-07-03 12:55:50 +0000
+++ click/tests/integration/helpers.py 2014-07-09 08:28:28 +0000
@@ -22,7 +22,6 @@
22import random22import random
23import shutil23import shutil
24import string24import string
25import shutil
26import subprocess25import subprocess
27import tempfile26import tempfile
28import unittest27import unittest
@@ -46,6 +45,8 @@
46 os.chdir(curdir)45 os.chdir(curdir)
4746
4847
48@unittest.skipUnless(
49 "TEST_INTEGRATION" in os.environ, "Skipping integration tests")
49class ClickTestCase(unittest.TestCase):50class ClickTestCase(unittest.TestCase):
5051
51 @classmethod52 @classmethod
5253
=== modified file 'click/tests/integration/test_build_core_apps.py'
--- tests/integration/test_build_core_apps.py 2014-07-02 18:21:32 +0000
+++ click/tests/integration/test_build_core_apps.py 2014-07-09 08:28:28 +0000
@@ -22,6 +22,8 @@
22import subprocess22import subprocess
23import unittest23import unittest
2424
25from six import with_metaclass
26
25from .helpers import (27from .helpers import (
26 chdir,28 chdir,
27 has_network,29 has_network,
@@ -65,7 +67,7 @@
6567
66@unittest.skipIf(not is_root(), "This tests needs to run as root")68@unittest.skipIf(not is_root(), "This tests needs to run as root")
67@unittest.skipIf(not has_network(), "Need network")69@unittest.skipIf(not has_network(), "Need network")
68class TestBuildCoreApps(ClickTestCase, metaclass=AddBranchTestFunctions):70class TestBuildCoreApps(with_metaclass(AddBranchTestFunctions, ClickTestCase)):
6971
70 def _run_in_chroot(self, cmd):72 def _run_in_chroot(self, cmd):
71 """Run the given cmd in a click chroot"""73 """Run the given cmd in a click chroot"""
@@ -117,6 +119,3 @@
117 self.configure()119 self.configure()
118 self.make()120 self.make()
119 self.create_click()121 self.create_click()
120
121
122
123122
=== modified file 'click/tests/integration/test_hook.py'
--- tests/integration/test_hook.py 2014-07-04 14:35:59 +0000
+++ click/tests/integration/test_hook.py 2014-07-09 08:28:28 +0000
@@ -55,7 +55,7 @@
55 subprocess.check_call(55 subprocess.check_call(
56 [self.click_binary, "hook", "install", hook_name])56 [self.click_binary, "hook", "install", hook_name])
57 self.addCleanup(57 self.addCleanup(
58 subprocess.check_call, [self.click_binary, "hook", "remove", 58 subprocess.check_call, [self.click_binary, "hook", "remove",
59 hook_name])59 hook_name])
60 # make click that uses the hook60 # make click that uses the hook
61 hooks = {'app1' : {hook_name: 'README'}}61 hooks = {'app1' : {hook_name: 'README'}}
@@ -67,7 +67,7 @@
67 self.click_binary, "install", "--user=%s" % user, click_pkg],67 self.click_binary, "install", "--user=%s" % user, click_pkg],
68 universal_newlines=True)68 universal_newlines=True)
69 self.addCleanup(69 self.addCleanup(
70 subprocess.check_call, 70 subprocess.check_call,
71 [self.click_binary, "unregister","--user=%s" % user,71 [self.click_binary, "unregister","--user=%s" % user,
72 click_pkg_name])72 click_pkg_name])
73 # ensure we have the hook73 # ensure we have the hook
7474
=== modified file 'debian/changelog'
--- debian/changelog 2014-07-04 15:10:01 +0000
+++ debian/changelog 2014-07-09 08:28:28 +0000
@@ -1,3 +1,13 @@
1click (0.4.30) UNRELEASED; urgency=medium
2
3 * Move integration tests to a location where they won't end up being
4 installed into inappropriate places on the system module path
5 (LP: #1337696).
6 * Use six.with_metaclass for TestBuildCoreApps, so that it doesn't make
7 pyflakes angry when running tests under Python 2.
8
9 -- Colin Watson <cjwatson@ubuntu.com> Tue, 08 Jul 2014 12:58:05 +0100
10
1click (0.4.29.1) utopic; urgency=medium11click (0.4.29.1) utopic; urgency=medium
212
3 [ Michael Vogt ]13 [ Michael Vogt ]
414
=== modified file 'debian/control'
--- debian/control 2014-06-10 17:18:00 +0000
+++ debian/control 2014-07-09 08:28:28 +0000
@@ -3,7 +3,7 @@
3Priority: optional3Priority: optional
4Maintainer: Colin Watson <cjwatson@ubuntu.com>4Maintainer: Colin Watson <cjwatson@ubuntu.com>
5Standards-Version: 3.9.55Standards-Version: 3.9.5
6Build-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-coverage6Build-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
7Vcs-Bzr: https://code.launchpad.net/~ubuntu-managed-branches/click/click7Vcs-Bzr: https://code.launchpad.net/~ubuntu-managed-branches/click/click
8Vcs-Browser: http://bazaar.launchpad.net/~ubuntu-managed-branches/click/click/files8Vcs-Browser: http://bazaar.launchpad.net/~ubuntu-managed-branches/click/click/files
9X-Auto-Uploader: no-rewrite-version9X-Auto-Uploader: no-rewrite-version
1010
=== modified file 'debian/tests/control'
--- debian/tests/control 2014-06-30 14:03:36 +0000
+++ debian/tests/control 2014-07-09 08:28:28 +0000
@@ -1,3 +1,3 @@
1Tests: run-tests.sh1Tests: run-tests.sh
2Depends: @, iputils-ping, click-dev, schroot, debootstrap, sudo, bzr2Depends: @, iputils-ping, click-dev, schroot, debootstrap, sudo, bzr, python3-six
3Restrictions: needs-root allow-stderr3Restrictions: needs-root allow-stderr
44
=== modified file 'debian/tests/run-tests.sh'
--- debian/tests/run-tests.sh 2014-06-11 12:40:44 +0000
+++ debian/tests/run-tests.sh 2014-07-09 08:28:28 +0000
@@ -2,4 +2,4 @@
22
3set -e3set -e
44
5python3 -m unittest discover tests.integration5TEST_INTEGRATION=1 python3 -m unittest discover -vv click.tests.integration
66
=== removed directory 'tests'
=== removed file 'tests/__init__.py'

Subscribers

People subscribed via source and target branches

to all changes: