Access mrmlScene from terminal using PythonSlicer

Hi everybody.
I have used PythonSlicer from terminal before. I’ve used it to run scripts using the environment and dependencies that come with slicer. Ex: ./PythonSlicer ~/test.py

Now I want to run a python script using PythonSlicer, but I want to be able to use mrmlScene from within the script. I do not need to access any buttons, sliderwidgets, etc. Those values can be hardcoded. For example, I want to be able to run the following
segmentationNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSegmentationNode")

Basically, I want to test python scripts in Slicer without having to launch the application so that the tests can run in a docker image.
Please suggest ways to make this happen.

Also, I have observed in various modules such as Vascular Modeling Toolkit that there is usually a Reload and Test button and its code in written in a test class within the module.py
Is there any way to run this test without launching the slicer application?