Chunk name in undoInfo

Hi all, I am trying to use undoInfo using chunkName so that I can easily access undo/redo pertaining to this name that I created.

I tried with the following code:

myChunk = cmds.undoInfo(openChunk=True, chunkName="myTest")
cmds.spaceLocator(n='test')
cmds.setAttr('test.translateX', 10)
cmds.undoInfo(closeChunk=True, chunkName="myTest")

When I tried to do print cmds.undoInfo(undoName=True, q=True), it is returning me nothing as I am expecting to see myTest as part of the return results.

Am I doing it wrong?