Skip to content
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

TST: Testing an installed package shouldn't require root permissions #4353

Closed
mitya57 opened this issue Jul 25, 2013 · 9 comments · Fixed by #4356

Comments

@mitya57
Copy link

commented Jul 25, 2013

Trying to run nosetests3 pandas on an installed pandas package, I get:

ERROR: test_read_dta10 (pandas.io.tests.test_stata.StataTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pandas/io/tests/test_stata.py", line 207, in test_read_dta10
    original.to_stata(path, {'datetime': 'tc'}, False)
  File "/usr/lib/python3/dist-packages/pandas/core/frame.py", line 1503, in to_stata
    writer = StataWriter(fname,self,convert_dates=convert_dates, encoding=encoding, byteorder=byteorder)
  File "/usr/lib/python3/dist-packages/pandas/io/stata.py", line 745, in __init__
    self._file = _open_file_binary_write(fname, self._encoding)
  File "/usr/lib/python3/dist-packages/pandas/io/stata.py", line 577, in _open_file_binary_write
    return open(fname, "wb")
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3/dist-packages/pandas/io/tests/data/stata10.dta'

... and other similar errors. Maybe it'll be a good idea to fix the tests so that they can be run on an installed package without needing to modify the actually installed files.

@cpcloud

This comment has been minimized.

Copy link
Member

commented Jul 25, 2013

If you install the package locally then you don't need root permissions. If you install with sudo then you'll need root permissions.

@cpcloud

This comment has been minimized.

Copy link
Member

commented Jul 25, 2013

The tests themselves have nothing to do with the fact that they are being run as root, so it's not clear what you mean by

fix the tests so that they can be run on an installed package without needing to modify the actually installed files

see #761

@mitya57

This comment has been minimized.

Copy link
Author

commented Jul 25, 2013

@cpcloud Actually I use Debian package here, installed via package manager. Also, did you really see the traceback above? The test fails because it doesn't have permission to modify a file in /usr/lib — which is related to them being run as non-root.

If I didn't convince you, this failure can also be seen on Ubuntu's Jenkins server.

@cpcloud

This comment has been minimized.

Copy link
Member

commented Jul 25, 2013

Sorry, I guess I wasn't being clear. IIRC, most package managers require root permissions to install anything. Anyway, you're right. The tests should use make liberal use of the tempfile module when writing files.

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2013

@mitya57 I am pretty sure you are running with < 0.12. This was fixed to use a temporary (non permissioned) in 0.12.

@cpcloud

This comment has been minimized.

Copy link
Member

commented Jul 25, 2013

@jreback according to this line the jenkins server above is running 0.12

+ buildtree=/tmp/tmp.KLHag020rp/dsc0-build/pandas-0.12.0~rc1+git127-gec8920a/

although not sure if that is before or after the change u mentioned

that line is near the bottom of the page

@mitya57

This comment has been minimized.

Copy link
Author

commented Jul 25, 2013

Yeah, I'm using the same snapshot (ec8920a, 5-day-old), and don't see anything related in newer commits...

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2013

sorry....this actually specifies a direct path (which is wrong)..so yes...marking as a test bug

@jreback

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2013

ensure_clean will generate a safe temporary file, except when a full pathname is specified (which is wrong here)

ghost pushed a commit to freenas/ports that referenced this issue Oct 30, 2013
math/py-pandas: Update to 0.12.0
- Update to 0.12.0
- Two BUILD_DEPENDS are only RUN_DEPENDS, move them
- Patch some files out of MANIFEST.in
- Cherry pick upstream issue/commit [1]
- Define regression-test target and TEST_DEPENDS
- Document USES=display in support of unit tests

[1] pandas-dev/pandas#4353

PR:		ports/180889
Submitted by:	John W. O'Brien <john@saltant.com> (maintainer)
splbio pushed a commit to splbio/freebsd-ports that referenced this issue Nov 24, 2014
koobs
math/py-pandas: Update to 0.12.0
- Update to 0.12.0
- Two BUILD_DEPENDS are only RUN_DEPENDS, move them
- Patch some files out of MANIFEST.in
- Cherry pick upstream issue/commit [1]
- Define regression-test target and TEST_DEPENDS
- Document USES=display in support of unit tests

[1] pandas-dev/pandas#4353

PR:		ports/180889
Submitted by:	John W. O'Brien <john@saltant.com> (maintainer)


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@327698 35697150-7ecd-e111-bb59-0022644237b5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.