2023-06-05 10:24:55 +01:00
|
|
|
## Python Meterpreter
|
|
|
|
|
|
|
|
Running unit tests:
|
|
|
|
|
|
|
|
```
|
|
|
|
# Only required if less than python 3.3
|
2023-06-07 01:45:53 +01:00
|
|
|
python -m pip install mock
|
2023-06-05 10:24:55 +01:00
|
|
|
|
|
|
|
# Run the tests
|
|
|
|
python -m unittest discover -v ./tests
|
|
|
|
```
|
2023-06-05 18:51:16 +01:00
|
|
|
|
|
|
|
Running a single test failure:
|
|
|
|
|
|
|
|
```
|
|
|
|
python3 ./tests/test_file.py class_name
|
|
|
|
python3 ./tests/test_file.py class_name.method_name
|
|
|
|
|
|
|
|
# For example
|
|
|
|
python3 ./tests/test_ext_server_stdapi.py TestExtServerStdApi.test_stdapi_net_config_get_interfaces_via_osx_ifconfig
|
2023-06-07 01:45:53 +01:00
|
|
|
|
|
|
|
# Or:
|
|
|
|
python3 -m unittest tests.test_ext_server_stdapi.ExtServerStdApiFileSystemTest.test_stdapi_fs_stat
|
2023-06-05 18:51:16 +01:00
|
|
|
```
|
2023-06-21 13:00:49 +01:00
|
|
|
|
|
|
|
To debug tests, add the following code snippet to enter into an interactive debugger at the calling stack frame:
|
|
|
|
|
|
|
|
```python
|
|
|
|
import pdb; pdb.set_trace()
|
|
|
|
```
|