abstract usage of subprocess module and separate unit tests