Skip to content
This repository was archived by the owner on Sep 14, 2023. It is now read-only.

Commit c832b13

Browse files
committed
Make missing selinux a non fatal error
From now on we would only log an error if import of selinux fails as there are multiple cases where molecule execution can still succeed.
1 parent 5a5edf4 commit c832b13

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pytest_molecule/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ def pytest_configure(config):
2222
if sys.platform == 'linux':
2323
try:
2424
import selinux # noqa
25-
except Exception as e:
25+
except Exception:
2626
logging.error(
2727
"It appears that you are trying to use "
2828
"molecule with a Python interpreter that does not have the "
2929
"libselinux python bindings installed. These can only be "
3030
"installed using your distro package manager and are specific "
3131
"to each python version. Common package names: "
3232
"libselinux-python python2-libselinux python3-libselinux")
33-
raise e
33+
# we do not re-raise this exception because missing or broken
34+
# selinux bindings are not guaranteed to fail molecule execution.
3435

3536

3637
def pytest_collect_file(parent, path):

0 commit comments

Comments
 (0)