Thanks a lot for that hint! It works. Now I can also run unit tests.
I had to modify the script a little bit to work with python 3:
Import("env")
def after_upload(source, target, env):
print("Delay while uploading...")
import time
time.sleep(1)
print("Done!")
env.AddPostAction("upload", after_upload)