Skip to content

TST, COMPAT: Make MMapWrapper tests Windows compatible #13732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

gfyoung
Copy link
Member

@gfyoung gfyoung commented Jul 21, 2016

Partially addresses #13721 by addressing the MMapWrapper test failure. The issue was we didn't have control over the newline character, so the test was re-written to give us that control.

f.write(newline) # this "empty" line shouldn't raise
f.write('2,two,II' + newline)

f = open(path, 'r', newline=newline)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't u need to close this file (after using it)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that is true. Will fix.

@gfyoung gfyoung force-pushed the mmap-wrapper-windows-compat branch from 264352d to 5fe6b25 Compare July 21, 2016 02:58
@jreback
Copy link
Contributor

jreback commented Jul 21, 2016

I think you can use open(..., mode='U')?

@jreback jreback added IO CSV read_csv, to_csv Compat pandas objects compatability with Numpy or Python functions labels Jul 21, 2016
@gfyoung
Copy link
Member Author

gfyoung commented Jul 21, 2016

Unfortunately, that seems to butcher what the end-of-line characters are:

>>> f = open('test.txt', 'w+')
>>> f.write('a\r\n')
3
>>> f.write('a\r\n')
3
>>> f.write('a\r\n')
3
>>> f.close()
>>> f = open('test.txt', mode='U')
>>> f.readlines()   # mmap will recognize the '\r\n' though
['a\n', 'a\n', 'a\n']

@gfyoung
Copy link
Member Author

gfyoung commented Jul 21, 2016

@jreback : Because this is a readlines issue and NOT an issue with mmap, as workaround, I am going to call .strip() just to remove the newline character and compare actual content.

@gfyoung gfyoung force-pushed the mmap-wrapper-windows-compat branch from 5fe6b25 to dd1b60b Compare July 21, 2016 16:24
@codecov-io
Copy link

codecov-io commented Jul 21, 2016

Current coverage is 84.56% (diff: 100%)

Merging #13732 into master will not change coverage

@@             master     #13732   diff @@
==========================================
  Files           141        141          
  Lines         51196      51196          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          43296      43296          
  Misses         7900       7900          
  Partials          0          0          

Powered by Codecov. Last update bb6b5e5...dd1b60b

@gfyoung
Copy link
Member Author

gfyoung commented Jul 22, 2016

@jreback : I fixed the test, so Travis now passes. Ready to merge if there are no other concerns.

@jreback jreback added this to the 0.19.0 milestone Jul 22, 2016
@jreback
Copy link
Contributor

jreback commented Jul 22, 2016

lgtm (though @jorisvandenbossche if you'd test on windows to be sure)

@jreback jreback merged commit 4556957 into pandas-dev:master Jul 24, 2016
@jreback
Copy link
Contributor

jreback commented Jul 24, 2016

oddly though I cannot reproduce this anymore.......

@jreback jreback mentioned this pull request Jul 24, 2016
2 tasks
@gfyoung gfyoung deleted the mmap-wrapper-windows-compat branch July 24, 2016 16:13
@jorisvandenbossche
Copy link
Member

Sorry, I wasn't using my windows the last days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions IO CSV read_csv, to_csv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants