To run the unittests, do:
cd detectron2 python -m unittest discover -v -s ./tests
There are also end-to-end inference & training tests, in dev/run_*_tests.sh.