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
Closed

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

mitya57 opened this issue Jul 25, 2013 · 9 comments · Fixed by #4356
Labels
Testing pandas testing functions or related to the test suite
Milestone

Comments

@mitya57
Copy link

mitya57 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
Copy link
Member

cpcloud 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
Copy link
Member

cpcloud 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
Copy link
Author

mitya57 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
Copy link
Member

cpcloud 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
Copy link
Contributor

jreback 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
Copy link
Member

cpcloud 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
Copy link
Author

mitya57 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
Copy link
Contributor

jreback commented Jul 25, 2013

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

@jreback
Copy link
Contributor

jreback 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 truenas/ports that referenced this issue Oct 30, 2013
- 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
- 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
svmhdvn pushed a commit to svmhdvn/freebsd-ports that referenced this issue Jan 10, 2024
- 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants