shawnbrown/datatest

Improve error message for @working_directory decorator

shawnbrown opened this issue · 0 comments

If working_directory() is used as a decorator but the developer forgets to call it with a path, the error message can be confusing because the function is passed in implicitly (via decorator handling):

>>> from datatest import working_directory
>>>
>>> @working_directory
>>> def foo():
>>>     return True
...
TypeError: stat: path should be string, bytes, os.PathLike or integer, not function

This misuse is easily detectable in the code and it would be good to improve the error message to help users understand their mistake.