File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 10
10
import logging
11
11
import os
12
12
import pathlib
13
+ import platform
13
14
import shutil
14
15
import warnings
15
16
16
17
import attr
18
+ import pytest
17
19
18
20
from commoncode import fileutils
19
21
from commoncode .system import on_linux
@@ -74,6 +76,32 @@ def get_command(env_var=EXTRACTCODE_GUESTFISH_PATH_ENVVAR, command='guestfish'):
74
76
return cmd_loc
75
77
76
78
79
+ def get_etc_os_release_info (os_release_path = '/etc/os-release' ):
80
+ cfg_kv = {}
81
+ with open (os_release_path ) as f :
82
+ for line in f :
83
+ split_line = line .split ('=' )
84
+ if not split_line :
85
+ continue
86
+ k = split_line [0 ].strip ()
87
+ v = split_line [- 1 ].strip ()
88
+ cfg_kv [k ] = v
89
+ return cfg_kv
90
+
91
+
92
+ def is_on_ubuntu_22 ():
93
+ if not on_linux :
94
+ return False
95
+ os_release_info = get_etc_os_release_info ()
96
+ print (os_release_info )
97
+ return os_release_info ['ID' ] == 'ubuntu' and '22' in os_release_info ['VERSION_ID' ]
98
+
99
+ on_ubuntu_22 = is_on_ubuntu_22 ()
100
+
101
+ del is_on_ubuntu_22
102
+
103
+
104
+ @pytest .mark .skipif (on_ubuntu_22 , reason = 'Kernel is not readable on Ubuntu 22.04' )
77
105
def check_linux_kernel_is_readable ():
78
106
"""
79
107
Return True if the kernel executable file can be read. This is required by
You can’t perform that action at this time.
0 commit comments