Fixed a network test that caused setup-dependent fails.
Added tests for run.py and refactored it accordingly