mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
![]() ... instead of None. This avoids the need to allow type changes (None vs. str). Also adjust the tests accordingly. While on it, simplify the tests for attachment. attachment is always a str, therefore adjust the test to expect an empty str ('') instead of None - and later converting that None to ''. MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/786 Acked-by: John Johansen <john.johansen@canonical.com> |
||
---|---|---|
.. | ||
cleanprof_test.in | ||
cleanprof_test.out | ||
common_test.py | ||
easyprof.conf | ||
fake_ldd | ||
logprof.conf | ||
Makefile | ||
README.md | ||
runtests-py2.sh | ||
runtests-py3.sh | ||
severity_broken.db | ||
test-aa-cli-bootstrap.py | ||
test-aa-decode.py | ||
test-aa-easyprof.py | ||
test-aa-notify.py | ||
test-aa.py | ||
test-aare.py | ||
test-abi.py | ||
test-alias.py | ||
test-baserule.py | ||
test-boolean.py | ||
test-capability.py | ||
test-change_profile.py | ||
test-common.py | ||
test-config.py | ||
test-dbus.py | ||
test-example.py | ||
test-file.py | ||
test-include.py | ||
test-libapparmor-test_multi.py | ||
test-logparser.py | ||
test-minitools.py | ||
test-mount_parse.py | ||
test-network.py | ||
test-parser-simple-tests.py | ||
test-pivot_root_parse.py | ||
test-profile-list.py | ||
test-profile-storage.py | ||
test-profiles.py | ||
test-ptrace.py | ||
test-regex_matches.py | ||
test-rlimit.py | ||
test-severity.py | ||
test-signal.py | ||
test-translations.py | ||
test-unix_parse.py | ||
test-variable.py |
Running individual tests
Python's unittest allows individual tests to be executed by specifying the class name and the test on the command line. When running tests individually, the unittest framework executes the "setUp" and "tearDown" methods automatically. For more information, refer to the unittest documentation.
Make sure to set the environment variables pointing to the in-tree apparmor modules, and the in-tree libapparmor and its python wrapper:
$ export PYTHONPATH=..:../../libraries/libapparmor/swig/python/build/$(/usr/bin/python3 -c "import distutils.util; import platform; print(\"lib.%s-%s\" %(distutils.util.get_platform(), platform.python_version()[:3]))")
$ export __AA_CONFDIR=.
To execute the test individually, run:
$ python3 ./test-tile.py ClassFoo.test_bar