Merge lp:~xnox/apt-btrfs-snapshot/py3 into lp:apt-btrfs-snapshot
- py3
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 39 |
Proposed branch: | lp:~xnox/apt-btrfs-snapshot/py3 |
Merge into: | lp:apt-btrfs-snapshot |
Diff against target: |
288 lines (+93/-33) 6 files modified
apt-btrfs-snapshot (+6/-6) apt_btrfs_snapshot.py (+20/-17) debian/changelog (+26/-2) debian/control (+8/-2) debian/rules (+23/-1) test/test_apt_btrfs_snapshot.py (+10/-5) |
To merge this branch: | bzr merge lp:~xnox/apt-btrfs-snapshot/py3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Colin Watson (community) | Approve | ||
Michael Vogt | Pending | ||
Review via email: mp+109632@code.launchpad.net |
Commit message
Description of the change
python3 port and other fixes
Barry Warsaw (barry) wrote : | # |
On Jun 11, 2012, at 01:20 PM, Dmitrijs Ledkovs wrote:
>Dmitrijs Ledkovs has proposed merging lp:~dmitrij.ledkov/apt-btrfs-snapshot/py3 into lp:apt-btrfs-snapshot.
>
>Requested reviews:
> Canonical Foundations Team (canonical-
> Michael Vogt (mvo)
>
>For more details, see:
>https:/
>
>python3 port and other fixes
=== modified file 'apt-btrfs-
--- apt-btrfs-snapshot 2011-07-19 11:42:45 +0000
+++ apt-btrfs-snapshot 2012-06-11 13:19:19 +0000
> @@ -1,4 +1,4 @@
> -#!/usr/bin/python
> +#!/usr/bin/python3
> # Copyright (C) 2011 Canonical
> #
> # Author:
> @@ -17,6 +17,8 @@
> # this program; if not, write to the Free Software Foundation, Inc.,
> # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>
> +from __future__ import print_function
This import got me thinking. If apt-btrfs-snapshot (the script) will only run
in Python 3, then clearly we don't need this. If it could run in Python 2
(e.g. explicitly invoked ignoring the #! line, or if you want to hold out the
possibility of reverting to Python 2), then the import is fine, but possibly
incomplete.
(Aside: print_function was introduced in Python 2.6.0a2:
http://
It might be incompletely because you may also need to import unicode_literals
(FWIW, just as a blanket rule, I always import those two plus
absolute_import). The other thing you'll need to check is that the _()
function is defined properly for cross-py2/py3 compatibility. It's not clear
from the diff if this is the case.
Here's the thing: you always want _() to return unicode strings, and you want
the input to be unicode strings. In Python 2, gettext.gettext() is *not* the
right thing to use, you need gettext.ugettext(). In Python 3,
gettext.gettext() does operate on and return unicodes.
You can do something like this to make it work right (this is pulled from the
c-j code in u-m).
def setup_gettext():
domain = 'foo'
localedir = os.environ.
t = gettext.
try:
return t.ugettext
except AttributeError:
return t.gettext
Then...
_ = setup_gettext()
OTOH, if the script will always run under Python 3, most of that won't be
necessary.
=== modified file 'apt_btrfs_
--- apt_btrfs_
+++ apt_btrfs_
> @@ -16,9 +16,10 @@
> # this program; if not, write to the Free Software Foundation, Inc.,
> # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>
> +from __future__ import print_function
Even though you're not using gettext, I'd still consider including
unicode_literals here. The problem is that if in Python 2, you're operating
on 8-bit strings, they'll magically become unicodes in Python 3, and then
you're just asking for trouble. If the literals really should be 8-bit
strings (a.k.a. bytes) in both versions, then import unicode_literals and
prefix your byte literals with b''. That way, the intentions are clear, and
things will work the same in both versions.
> @@ -57,14 +58,16 @@
...
- 43. By Dimitri John Ledkov
-
Address barry's comments
Michael Vogt (mvo) wrote : | # |
Thanks for your work on this branch!
it looks good. One comment below:
On Mon, Jun 11, 2012 at 01:20:25PM -0000, Dmitrijs Ledkovs wrote:
> - def test_fstab_
> + @mock.patch(
This seems this requires python-mock 0.8, it would be nice if that
would still work on 12.04 for now if its not too much hassle to make
it easy for contributors to hack on it without the need to upgrade to
quantal just yet.
We should probably add a generic pyflakes and pep8 test to the tests
dir, I will do that in a bit.
Thanks,
Michael
Dimitri John Ledkov (xnox) wrote : | # |
Pushed upto -r44, which uses python-mock 0.7 style api/syntax. Works in precise pbuilder.
Regards,
Dmitrijs.
- 44. By Dimitri John Ledkov
-
use python-mock 0.7 API/syntax
Preview Diff
1 | === modified file 'apt-btrfs-snapshot' | |||
2 | --- apt-btrfs-snapshot 2011-07-19 11:42:45 +0000 | |||
3 | +++ apt-btrfs-snapshot 2012-06-11 17:29:49 +0000 | |||
4 | @@ -1,4 +1,4 @@ | |||
6 | 1 | #!/usr/bin/python | 1 | #!/usr/bin/python3 |
7 | 2 | # Copyright (C) 2011 Canonical | 2 | # Copyright (C) 2011 Canonical |
8 | 3 | # | 3 | # |
9 | 4 | # Author: | 4 | # Author: |
10 | @@ -84,21 +84,21 @@ | |||
11 | 84 | logging.basicConfig(level=logging.INFO) | 84 | logging.basicConfig(level=logging.INFO) |
12 | 85 | 85 | ||
13 | 86 | if os.getuid() != 0: | 86 | if os.getuid() != 0: |
15 | 87 | print _("Sorry, you need to be root to run this program") | 87 | print(_("Sorry, you need to be root to run this program")) |
16 | 88 | sys.exit(1) | 88 | sys.exit(1) |
17 | 89 | 89 | ||
18 | 90 | apt_btrfs = AptBtrfsSnapshot() | 90 | apt_btrfs = AptBtrfsSnapshot() |
19 | 91 | if not apt_btrfs.snapshots_supported(): | 91 | if not apt_btrfs.snapshots_supported(): |
21 | 92 | print _("Sorry, your system lacks support for the snapshot feature") | 92 | print(_("Sorry, your system lacks support for the snapshot feature")) |
22 | 93 | sys.exit(1) | 93 | sys.exit(1) |
23 | 94 | 94 | ||
24 | 95 | res = False | 95 | res = False |
25 | 96 | if args.command == "supported": | 96 | if args.command == "supported": |
26 | 97 | res = apt_btrfs.snapshots_supported() | 97 | res = apt_btrfs.snapshots_supported() |
27 | 98 | if res: | 98 | if res: |
29 | 99 | print _("Supported") | 99 | print(_("Supported")) |
30 | 100 | else: | 100 | else: |
32 | 101 | print _("Not supported") | 101 | print(_("Not supported")) |
33 | 102 | elif args.command == "snapshot": | 102 | elif args.command == "snapshot": |
34 | 103 | res = apt_btrfs.create_btrfs_root_snapshot() | 103 | res = apt_btrfs.create_btrfs_root_snapshot() |
35 | 104 | elif args.command == "list": | 104 | elif args.command == "list": |
36 | @@ -112,7 +112,7 @@ | |||
37 | 112 | elif args.command == "delete-older-than": | 112 | elif args.command == "delete-older-than": |
38 | 113 | res = apt_btrfs.clean_btrfs_root_snapshots_older_than(args.time) | 113 | res = apt_btrfs.clean_btrfs_root_snapshots_older_than(args.time) |
39 | 114 | else: | 114 | else: |
41 | 115 | print _("ERROR: Unhandled command: '%s'") % args.command | 115 | print(_("ERROR: Unhandled command: '%s'") % args.command) |
42 | 116 | 116 | ||
43 | 117 | # return the right exit code | 117 | # return the right exit code |
44 | 118 | if res: | 118 | if res: |
45 | 119 | 119 | ||
46 | === modified file 'apt_btrfs_snapshot.py' | |||
47 | --- apt_btrfs_snapshot.py 2011-10-17 08:05:22 +0000 | |||
48 | +++ apt_btrfs_snapshot.py 2012-06-11 17:29:49 +0000 | |||
49 | @@ -16,9 +16,10 @@ | |||
50 | 16 | # this program; if not, write to the Free Software Foundation, Inc., | 16 | # this program; if not, write to the Free Software Foundation, Inc., |
51 | 17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 17 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
52 | 18 | 18 | ||
53 | 19 | from __future__ import print_function, unicode_literals | ||
54 | 20 | |||
55 | 19 | import datetime | 21 | import datetime |
56 | 20 | import os | 22 | import os |
57 | 21 | import string | ||
58 | 22 | import subprocess | 23 | import subprocess |
59 | 23 | import sys | 24 | import sys |
60 | 24 | import time | 25 | import time |
61 | @@ -57,14 +58,16 @@ | |||
62 | 57 | """ a list of FstabEntry items """ | 58 | """ a list of FstabEntry items """ |
63 | 58 | def __init__(self, fstab="/etc/fstab"): | 59 | def __init__(self, fstab="/etc/fstab"): |
64 | 59 | super(Fstab, self).__init__() | 60 | super(Fstab, self).__init__() |
73 | 60 | for line in map(string.strip, open(fstab)): | 61 | |
74 | 61 | if line == "" or line.startswith("#"): | 62 | with open(fstab) as fstab_file: |
75 | 62 | continue | 63 | for line in (l.strip() for l in fstab_file): |
76 | 63 | try: | 64 | if line == "" or line.startswith("#"): |
77 | 64 | entry = FstabEntry.from_line(line) | 65 | continue |
78 | 65 | except ValueError: | 66 | try: |
79 | 66 | continue | 67 | entry = FstabEntry.from_line(line) |
80 | 67 | self.append(entry) | 68 | except ValueError: |
81 | 69 | continue | ||
82 | 70 | self.append(entry) | ||
83 | 68 | 71 | ||
84 | 69 | class LowLevelCommands(object): | 72 | class LowLevelCommands(object): |
85 | 70 | """ lowlevel commands invoked to perform various tasks like | 73 | """ lowlevel commands invoked to perform various tasks like |
86 | @@ -133,7 +136,7 @@ | |||
87 | 133 | self._btrfs_root_mountpoint = None | 136 | self._btrfs_root_mountpoint = None |
88 | 134 | return res | 137 | return res |
89 | 135 | def _get_now_str(self): | 138 | def _get_now_str(self): |
91 | 136 | return datetime.datetime.now().replace(microsecond=0).isoformat("_") | 139 | return datetime.datetime.now().replace(microsecond=0).isoformat(str('_')) |
92 | 137 | def create_btrfs_root_snapshot(self, additional_prefix=""): | 140 | def create_btrfs_root_snapshot(self, additional_prefix=""): |
93 | 138 | mp = self.mount_btrfs_root_volume() | 141 | mp = self.mount_btrfs_root_volume() |
94 | 139 | snap_id = self._get_now_str() | 142 | snap_id = self._get_now_str() |
95 | @@ -153,7 +156,7 @@ | |||
96 | 153 | if older_than != 0: | 156 | if older_than != 0: |
97 | 154 | entry = self._get_supported_btrfs_root_fstab_entry() | 157 | entry = self._get_supported_btrfs_root_fstab_entry() |
98 | 155 | if not entry: | 158 | if not entry: |
100 | 156 | raise AptBtrfsSnapshotNotSupportedError() | 159 | raise AptBtrfsNotSupportedError() |
101 | 157 | if "noatime" in entry.options: | 160 | if "noatime" in entry.options: |
102 | 158 | raise AptBtrfsRootWithNoatimeError() | 161 | raise AptBtrfsRootWithNoatimeError() |
103 | 159 | # if there is no older than, interpret that as "now" | 162 | # if there is no older than, interpret that as "now" |
104 | @@ -170,8 +173,8 @@ | |||
105 | 170 | self.umount_btrfs_root_volume() | 173 | self.umount_btrfs_root_volume() |
106 | 171 | return l | 174 | return l |
107 | 172 | def print_btrfs_root_snapshots(self): | 175 | def print_btrfs_root_snapshots(self): |
110 | 173 | print "Available snapshots:" | 176 | print("Available snapshots:") |
111 | 174 | print " \n".join(self.get_btrfs_root_snapshots_list()) | 177 | print(" \n".join(self.get_btrfs_root_snapshots_list())) |
112 | 175 | return True | 178 | return True |
113 | 176 | def _parse_older_than_to_unixtime(self, timefmt): | 179 | def _parse_older_than_to_unixtime(self, timefmt): |
114 | 177 | now = time.time() | 180 | now = time.time() |
115 | @@ -182,9 +185,9 @@ | |||
116 | 182 | def print_btrfs_root_snapshots_older_than(self, timefmt): | 185 | def print_btrfs_root_snapshots_older_than(self, timefmt): |
117 | 183 | older_than_unixtime = self._parse_older_than_to_unixtime(timefmt) | 186 | older_than_unixtime = self._parse_older_than_to_unixtime(timefmt) |
118 | 184 | try: | 187 | try: |
122 | 185 | print "Available snapshots older than '%s':" % timefmt | 188 | print("Available snapshots older than '%s':" % timefmt) |
123 | 186 | print " \n".join(self.get_btrfs_root_snapshots_list( | 189 | print(" \n".join(self.get_btrfs_root_snapshots_list( |
124 | 187 | older_than=older_than_unixtime)) | 190 | older_than=older_than_unixtime))) |
125 | 188 | except AptBtrfsRootWithNoatimeError: | 191 | except AptBtrfsRootWithNoatimeError: |
126 | 189 | sys.stderr.write("Error: fstab option 'noatime' incompatible with option") | 192 | sys.stderr.write("Error: fstab option 'noatime' incompatible with option") |
127 | 190 | return False | 193 | return False |
128 | @@ -202,7 +205,7 @@ | |||
129 | 202 | return res | 205 | return res |
130 | 203 | def command_set_default(self, snapshot_name): | 206 | def command_set_default(self, snapshot_name): |
131 | 204 | res = self.set_default(snapshot_name) | 207 | res = self.set_default(snapshot_name) |
133 | 205 | print "Please reboot" | 208 | print("Please reboot") |
134 | 206 | return res | 209 | return res |
135 | 207 | def set_default(self, snapshot_name, backup=True): | 210 | def set_default(self, snapshot_name, backup=True): |
136 | 208 | """ set new default """ | 211 | """ set new default """ |
137 | 209 | 212 | ||
138 | === modified file 'debian/changelog' | |||
139 | --- debian/changelog 2011-10-17 08:05:22 +0000 | |||
140 | +++ debian/changelog 2012-06-11 17:29:49 +0000 | |||
141 | @@ -1,5 +1,6 @@ | |||
143 | 1 | apt-btrfs-snapshot (0.2.2) UNRELEASEDoneiric-proposed; urgency=low | 1 | apt-btrfs-snapshot (0.2.2) UNRELEASED; urgency=low |
144 | 2 | 2 | ||
145 | 3 | [ Michael Vogt ] | ||
146 | 3 | * apt_btrfs_snapshot.py, test/test_apt_btrfs_snapshot.py: | 4 | * apt_btrfs_snapshot.py, test/test_apt_btrfs_snapshot.py: |
147 | 4 | - disable "delete-older-than" command if noatime is in use on | 5 | - disable "delete-older-than" command if noatime is in use on |
148 | 5 | the snapshot fs (LP: #833980) | 6 | the snapshot fs (LP: #833980) |
149 | @@ -8,7 +9,30 @@ | |||
150 | 8 | - be even more robust against invalid fstab entries | 9 | - be even more robust against invalid fstab entries |
151 | 9 | (LP: #873411 comment #7) | 10 | (LP: #873411 comment #7) |
152 | 10 | 11 | ||
154 | 11 | -- Michael Vogt <michael.vogt@ubuntu.com> Tue, 11 Oct 2011 10:20:45 +0200 | 12 | [ Dmitrijs Ledkovs ] |
155 | 13 | * apt_btrfs_snapshot.py, apt-btrfs-snapshot: | ||
156 | 14 | - port to python3 | ||
157 | 15 | * apt_btrfs_snapshot.py: | ||
158 | 16 | - fix pyflakes warning use 'AptBtrfsNotSupportedError' instead of | ||
159 | 17 | undefined name 'AptBtrfsSnapshotNotSupportedError' | ||
160 | 18 | * test/test_apt_btrfs_snapshot.py: | ||
161 | 19 | - remove unused imports 'LowLevelCommands' and 'apt_btrfs_snapshot' | ||
162 | 20 | - mock sys.stdout and sys.stderr to avoid confusing and spurious output | ||
163 | 21 | - mock /sbin/btrfs to allow running unit-tests without btrfs-tools | ||
164 | 22 | * debian/rules: | ||
165 | 23 | - build with supported versions of python2 and python3 | ||
166 | 24 | - run unittests at build time, honoring nocheck | ||
167 | 25 | * debian/control: | ||
168 | 26 | - adjust dependencies for python3 support | ||
169 | 27 | - bump standards version to 3.9.3 | ||
170 | 28 | |||
171 | 29 | -- Dmitrijs Ledkovs <dmitrij.ledkov@ubuntu.com> Mon, 11 Jun 2012 14:07:41 +0100 | ||
172 | 30 | |||
173 | 31 | apt-btrfs-snapshot (0.2.1build1) precise; urgency=low | ||
174 | 32 | |||
175 | 33 | * Rebuild to drop python2.6 dependencies. | ||
176 | 34 | |||
177 | 35 | -- Matthias Klose <doko@ubuntu.com> Sat, 31 Dec 2011 02:00:37 +0000 | ||
178 | 12 | 36 | ||
179 | 13 | apt-btrfs-snapshot (0.2.1) oneiric; urgency=low | 37 | apt-btrfs-snapshot (0.2.1) oneiric; urgency=low |
180 | 14 | 38 | ||
181 | 15 | 39 | ||
182 | === modified file 'debian/control' | |||
183 | --- debian/control 2011-10-10 21:21:46 +0000 | |||
184 | +++ debian/control 2012-06-11 17:29:49 +0000 | |||
185 | @@ -2,16 +2,22 @@ | |||
186 | 2 | Section: admin | 2 | Section: admin |
187 | 3 | Priority: optional | 3 | Priority: optional |
188 | 4 | Maintainer: Michael Vogt <michael.vogt@ubuntu.com> | 4 | Maintainer: Michael Vogt <michael.vogt@ubuntu.com> |
190 | 5 | Build-Depends: debhelper (>= 7), | 5 | Build-Depends: debhelper (>= 7.0.50~), |
191 | 6 | python3, | ||
192 | 7 | python3-distutils-extra, | ||
193 | 8 | python3-mock, | ||
194 | 6 | python (>= 2.6.5-2~), | 9 | python (>= 2.6.5-2~), |
195 | 7 | python-distutils-extra, | 10 | python-distutils-extra, |
196 | 11 | python-mock, | ||
197 | 8 | X-Python-Version: all | 12 | X-Python-Version: all |
199 | 9 | Standards-Version: 3.9.1 | 13 | X-Python3-Version: >= 3.2 |
200 | 14 | Standards-Version: 3.9.3 | ||
201 | 10 | Vcs-Bzr: https://code.launchpad.net/apt-btrfs-snapshot | 15 | Vcs-Bzr: https://code.launchpad.net/apt-btrfs-snapshot |
202 | 11 | 16 | ||
203 | 12 | Package: apt-btrfs-snapshot | 17 | Package: apt-btrfs-snapshot |
204 | 13 | Architecture: all | 18 | Architecture: all |
205 | 14 | Depends: ${python:Depends}, | 19 | Depends: ${python:Depends}, |
206 | 20 | ${python3:Depends}, | ||
207 | 15 | ${misc:Depends}, | 21 | ${misc:Depends}, |
208 | 16 | btrfs-tools | 22 | btrfs-tools |
209 | 17 | Description: Automatically create snapshot on apt operations | 23 | Description: Automatically create snapshot on apt operations |
210 | 18 | 24 | ||
211 | === modified file 'debian/rules' | |||
212 | --- debian/rules 2011-02-16 11:56:59 +0000 | |||
213 | +++ debian/rules 2012-06-11 17:29:49 +0000 | |||
214 | @@ -1,5 +1,27 @@ | |||
215 | 1 | #!/usr/bin/make -f | 1 | #!/usr/bin/make -f |
216 | 2 | PYTHON2:=$(shell pyversions -r) | ||
217 | 3 | PYTHON3:=$(shell py3versions -r) | ||
218 | 4 | py3sdo=set -e; $(foreach py, $(PYTHON3), $(py) $(1);) | ||
219 | 5 | pyalldo=set -e; $(foreach py, $(PYTHON2) $(PYTHON3), $(py) $(1);) | ||
220 | 2 | 6 | ||
221 | 3 | %: | 7 | %: |
223 | 4 | dh $@ --with python2 | 8 | dh $@ --with python2,python3 |
224 | 9 | |||
225 | 10 | ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) | ||
226 | 11 | override_dh_auto_test: | ||
227 | 12 | $(call pyalldo, -m unittest discover -vv test/) | ||
228 | 13 | endif | ||
229 | 14 | |||
230 | 15 | override_dh_auto_build: | ||
231 | 16 | dh_auto_build | ||
232 | 17 | $(call py3sdo, setup.py build) | ||
233 | 18 | |||
234 | 19 | override_dh_auto_install: | ||
235 | 20 | dh_auto_install | ||
236 | 21 | $(call py3sdo, setup.py install --root=$(CURDIR)/debian/apt-btrfs-snapshot --install-layout=deb) | ||
237 | 22 | |||
238 | 23 | override_dh_auto_clean: | ||
239 | 24 | dh_auto_clean | ||
240 | 25 | rm -rf build | ||
241 | 26 | rm -rf *.egg-info | ||
242 | 5 | 27 | ||
243 | 6 | 28 | ||
244 | === modified file 'test/test_apt_btrfs_snapshot.py' | |||
245 | --- test/test_apt_btrfs_snapshot.py 2011-10-17 08:05:22 +0000 | |||
246 | +++ test/test_apt_btrfs_snapshot.py 2012-06-11 17:29:49 +0000 | |||
247 | @@ -1,5 +1,9 @@ | |||
248 | 1 | #!/usr/bin/python | 1 | #!/usr/bin/python |
249 | 2 | 2 | ||
250 | 3 | try: | ||
251 | 4 | from StringIO import StringIO | ||
252 | 5 | except ImportError: | ||
253 | 6 | from io import StringIO | ||
254 | 3 | import mock | 7 | import mock |
255 | 4 | import os | 8 | import os |
256 | 5 | import sys | 9 | import sys |
257 | @@ -8,17 +12,16 @@ | |||
258 | 8 | 12 | ||
259 | 9 | sys.path.insert(0, "..") | 13 | sys.path.insert(0, "..") |
260 | 10 | sys.path.insert(0, ".") | 14 | sys.path.insert(0, ".") |
261 | 11 | import apt_btrfs_snapshot | ||
262 | 12 | from apt_btrfs_snapshot import (AptBtrfsSnapshot, | 15 | from apt_btrfs_snapshot import (AptBtrfsSnapshot, |
265 | 13 | AptBtrfsRootWithNoatimeError, | 16 | AptBtrfsRootWithNoatimeError) |
264 | 14 | LowLevelCommands) | ||
266 | 15 | 17 | ||
267 | 16 | class TestFstab(unittest.TestCase): | 18 | class TestFstab(unittest.TestCase): |
268 | 17 | 19 | ||
269 | 18 | def setUp(self): | 20 | def setUp(self): |
270 | 19 | self.testdir = os.path.dirname(os.path.abspath(__file__)) | 21 | self.testdir = os.path.dirname(os.path.abspath(__file__)) |
271 | 20 | 22 | ||
273 | 21 | def test_fstab_detect_snapshot(self): | 23 | @mock.patch('os.path.exists', side_effect=lambda f: f in ('/sbin/btrfs')) |
274 | 24 | def test_fstab_detect_snapshot(self, mock_commands): | ||
275 | 22 | apt_btrfs = AptBtrfsSnapshot( | 25 | apt_btrfs = AptBtrfsSnapshot( |
276 | 23 | fstab=os.path.join(self.testdir, "data", "fstab")) | 26 | fstab=os.path.join(self.testdir, "data", "fstab")) |
277 | 24 | self.assertTrue(apt_btrfs.snapshots_supported()) | 27 | self.assertTrue(apt_btrfs.snapshots_supported()) |
278 | @@ -38,7 +41,9 @@ | |||
279 | 38 | self.assertEqual(apt_btrfs._uuid_for_mountpoint("/"), | 41 | self.assertEqual(apt_btrfs._uuid_for_mountpoint("/"), |
280 | 39 | "UUID=fe63f598-1906-478e-acc7-f74740e78d1f") | 42 | "UUID=fe63f598-1906-478e-acc7-f74740e78d1f") |
281 | 40 | 43 | ||
283 | 41 | def test_fstab_noatime(self): | 44 | @mock.patch('sys.stdout', new_callable=StringIO) |
284 | 45 | @mock.patch('sys.stderr', new_callable=StringIO) | ||
285 | 46 | def test_fstab_noatime(self, mock_stdout, mock_stderr): | ||
286 | 42 | apt_btrfs = AptBtrfsSnapshot( | 47 | apt_btrfs = AptBtrfsSnapshot( |
287 | 43 | fstab=os.path.join(self.testdir, "data", "fstab.bug833980")) | 48 | fstab=os.path.join(self.testdir, "data", "fstab.bug833980")) |
288 | 44 | # ensure our test is right | 49 | # ensure our test is right |
Looks good to me, though I'd like Michael to review this and merge if he's happy.