@@ -209,14 +209,13 @@ def test_help_contents(self):
209
209
-p, --poll poll AppArmor logs and display notifications
210
210
--display DISPLAY set the DISPLAY environment variable (might be needed if
211
211
sudo resets $DISPLAY)
212
- -f FILE , --file FILE search FILE for AppArmor messages
212
+ -f, --file FILE search FILE for AppArmor messages
213
213
-l, --since-last display stats since last login
214
- -s NUM, --since-days NUM
215
- show stats for last NUM days (can be used alone or with
214
+ -s, --since-days NUM show stats for last NUM days (can be used alone or with
216
215
-p)
217
216
-v, --verbose show messages with stats
218
- -u USER , --user USER user to drop privileges to when not using sudo
219
- -w NUM , --wait NUM wait NUM seconds before displaying notifications (with
217
+ -u, --user USER user to drop privileges to when not using sudo
218
+ -w, --wait NUM wait NUM seconds before displaying notifications (with
220
219
-p)
221
220
-m, --merge-notifications
222
221
Merge notification for improved readability (with -p)
@@ -240,6 +239,28 @@ def test_help_contents(self):
240
239
regular expression to match the network socket type
241
240
''' # noqa: E128
242
241
242
+ if sys .version_info [:2 ] < (3 , 13 ):
243
+ # Python 3.13 tweaked argparse output [1]. When running on older
244
+ # Python versions, we adapt the expected output to match.
245
+ #
246
+ # https://github.com/python/cpython/pull/103372
247
+ patches = [(
248
+ ' -f, --file FILE search FILE for AppArmor messages' ,
249
+ ' -f FILE, --file FILE search FILE for AppArmor messages' ,
250
+ ), (
251
+ ' -s, --since-days NUM show stats for last NUM days (can be used alone or with' ,
252
+ ' -s NUM, --since-days NUM\n '
253
+ + ' show stats for last NUM days (can be used alone or with' ,
254
+ ), (
255
+ ' -u, --user USER user to drop privileges to when not using sudo' ,
256
+ ' -u USER, --user USER user to drop privileges to when not using sudo' ,
257
+ ), (
258
+ ' -w, --wait NUM wait NUM seconds before displaying notifications (with' ,
259
+ ' -w NUM, --wait NUM wait NUM seconds before displaying notifications (with' ,
260
+ )]
261
+ for patch in patches :
262
+ expected_output_2 = expected_output_2 .replace (patch [0 ], patch [1 ])
263
+
243
264
return_code , output = cmd (aanotify_bin + ['--help' ])
244
265
result = 'Got return code {}, expected {}\n ' .format (return_code , expected_return_code )
245
266
self .assertEqual (expected_return_code , return_code , result + output )
0 commit comments