pwndbg/pytests_launcher.py

33 lines
633 B
Python
Raw Normal View History

import os
import sys
import pytest
2022-08-30 08:53:00 +08:00
use_pdb = os.environ.get("USE_PDB") == "1"
sys._pwndbg_unittest_run = True
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
2022-08-30 08:53:00 +08:00
test = os.environ["PWNDBG_LAUNCH_TEST"]
test = os.path.join(CURRENT_DIR, test)
2022-08-30 08:53:00 +08:00
args = [test, "-vvv", "-s", "--showlocals", "--color=yes"]
if use_pdb:
2022-08-30 08:53:00 +08:00
args.append("--pdb")
2022-08-30 08:53:00 +08:00
print("Launching pytest with args: %s" % args)
return_code = pytest.main(args)
if return_code != 0:
2022-08-30 08:53:00 +08:00
print("-" * 80)
print(
"If you want to debug tests locally, modify {} and add --pdb to its args".format(__file__)
)
print("-" * 80)
sys.exit(return_code)