Skip to content

Commit

Permalink
BF(workaround): manually replace os.linesep with \n upon "rb" in ok_f…
Browse files Browse the repository at this point in the history
…ile_has_content
  • Loading branch information
yarikoptic committed Dec 4, 2018
1 parent f4e98db commit d110255
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions datalad/tests/utils.py
Expand Up @@ -410,6 +410,12 @@ def ok_file_has_content(path, content, strip=False, re_=False,
if isinstance(content, text_type):
file_content = assure_unicode(file_content)

if os.linesep != '\n':
# for consistent comparisons etc. Apparently when reading in `b` mode
# on Windows we would also get \r
# https://github.com/datalad/datalad/pull/3049#issuecomment-444128715
file_content = file_content.replace(os.linesep, '\n')

if strip:
file_content = file_content.strip()

Expand Down

0 comments on commit d110255

Please sign in to comment.