os.getpid() in Bitcoin's python test scripts - What does it actually do?
os.getpid() in Python is getting the current process id. The processor id is 'random-ish', in that running the entire test several times will result in a different pid, but within the same test the pid will remain constant. 

The % operator is the modulus operator, which is essentially chopping off all but the last 3 digits of the processor id. 

Together os.getpid() % 999 is getting a constant offset and ignoring all but the last 3 digits. This new 3 digit number of added to the constant 11000 to return the port number to use.