Moved socket tests into functions to test file will show up in pytest output.