first-pass porting of pythonTestDirML