Skip to content

Improve error message for @working_directory decorator #56

@shawnbrown

Description

@shawnbrown

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions