Reworking tests so they pass on Windows (and *nix)
The tests of the following functions will not pass because they assume unix paths:
DirCheck
FileCheck
NewPathCheck
PathCheck
These are all in mailpile/config/validators.py
Thank you for reporting this!
Hopefully someone who is comfortable with both Windows and Unix will fix the tests so they work on both sides.
I thought a bit about possible solutions and the easiest that I can think of would look something like this:
from sys import platform
...
"""
>>> on_windows = platform == 'win32'
>>> path = 'C:\\Users\\..\\' if on_windows else '/etc/../'
>>> abspath = 'C:\\' if on_windows else '/'
>>> PathCheck(path) == abspath
True
"""
I couldn’t test it yet because I currently don’t have access to a computer. I just wanted to throw this in to see what you think of this. Does it complicate the tests to much?
That's actually relatively readable - I think that's a good approach. I'd merge that PR! :smile:
Great. I'll start working on this
TIL: Escaping a backslash in a doctest results in a error. They don't need to and mustn't be escaped.