After further testing I think it has to do with caching. I copied more and more functions from the original module to the test one, testing each time. By the end I just copied and pasted everything, changing only the module name to Test in the test module. It worked with no problems. Then I tried the original module again and the same old errors came up.
How do I reset the documentation cache of a module?
