2022-02-13 15:37:21 +00:00
|
|
|
# Test data generated elsewhere
|
|
|
|
|
|
|
|
The tests in `parser` generate additional test profiles in
|
|
|
|
`parser/tst/simple_tests/`: see `gen-dbus.py` and `gen-xtrans.py`.
|
|
|
|
|
|
|
|
`utils/test/test-parser-simple-tests.py` uses this test data when it is
|
|
|
|
available. If this test data has not been generated, this test will not
|
|
|
|
complain: it will simply exercise fewer test profiles.
|
|
|
|
|
2021-06-21 12:57:25 +00:00
|
|
|
# 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](https://docs.python.org/3/library/unittest.html).
|
|
|
|
|
|
|
|
Make sure to set the environment variables pointing to the in-tree apparmor modules, and the in-tree libapparmor and its python wrapper:
|
|
|
|
|
|
|
|
```bash
|
2022-07-16 00:42:14 +02:00
|
|
|
$ export PYTHONPATH=..:../../libraries/libapparmor/swig/python/build/$(/usr/bin/python3 ../../libraries/libapparmor/swig/python/test/buildpath.py)
|
2021-06-21 12:57:25 +00:00
|
|
|
$ export __AA_CONFDIR=.
|
|
|
|
```
|
|
|
|
|
|
|
|
To execute the test individually, run:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ python3 ./test-tile.py ClassFoo.test_bar
|
2022-07-16 00:42:14 +02:00
|
|
|
```
|