From aa7037f35c77ea1bbb78860e7dc3c40509a980d9 Mon Sep 17 00:00:00 2001 From: Jan Zarsky Date: Tue, 7 May 2019 11:03:36 +0200 Subject: [PATCH 2/2] Allow running test_main.py directly By default, the tests are run using the 'python3 -m unittest' command. Allow running 'test_main.py' directly so that the 'selinux_enabled' argument can be specified. When running on SELinux-enabled systems, the tests can be rerun with: python3 test_main.py selinux_enabled --- tests/test_main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_main.py b/tests/test_main.py index 08805db..6f37cbd 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -116,3 +116,9 @@ class TestMain(unittest.TestCase): self.assertMultiLineEqual(policy, exp_policy) os.unlink('my_container.cil') + +if __name__ == "__main__": + if 'selinux_enabled' in sys.argv: + SELINUX_ENABLED = True + sys.argv.remove('selinux_enabled') + unittest.main() -- 2.20.1