# copypaste all of this into the docker shell, good idea to include this line too python3 - <<'EOF' import os top='/w/' # the folder we'll be testin in fn1='t.tf.1' # test-filename 1 fn2='t.tf.2' # test-filename 2 ap1=top+fn1 # full path to file 1 ap2=top+fn2 # full path to file 2 # first make sure we delete any old remnants from previous tests print('a') for f in [ap1,ap2]: if os.path.exists(f): os.unlink(f) # ok this is what we're starting from print('b') files=os.listdir(top) assert(fn1 not in files) assert(fn2 not in files) # create a file and then make sure it appears immediately print('c') with open(ap1,'wb') as f: f.close() files=os.listdir(top) assert(fn1 in files) # ok now rename it and make sure it immediately takes effect visibly print('d') os.rename(ap1,ap2) files=os.listdir(top) assert(fn1 not in files) assert(fn2 in files) # now delete it, then immediately create another file with the same name print('e') os.unlink(ap2) with open(ap2,'wb') as f: f.close() files=os.listdir(top) assert(fn2 in files) # and finally just delete it print('f') os.unlink(ap2) files=os.listdir(top) assert(fn1 not in files) assert(fn2 not in files) print('\n\ntest finished, no issues, all good') EOF echo $?