PySnooper
PySnooper copied to clipboard
Testing enhancement: Test `pip install`
@bittner , this is right up your alley so if you'll feel like doing it, it'll be cool.
It'll be nice if after every release, or after every push to master, there will be separate tests that do pip install pysnooper on all platforms and run the tests. This is to rule out any errors in the installation.
Every Python environment created by Tox gets pysnooper installed. The workflow is roughly:
- Create virtualenv for Python x.y (e.g. Python 3.7 for
py37) - Run
python setup.py install(i.e. installpysnooper) - Install the dependencies (from
deps = ...in the Tox environment) - Run
pytest(i.e. fromcommands = ...)
If I'm not completely mistaken pip install pysnooper does nothing else than download the package from PyPI and run python setup.py install. Hence, in theory installing should succeed when Tox runs successfully. And this is now ensured.
Any doubt about this?
What is missing indeed is that tests are run on Windows and macOS. We've done this with PythonTurtle already, it's tedious but it's feasible, it's not magic.
And more tests, e.g. integration tests, are always a good idea. Sure!
Are you sure tox does setup.py install? Where is it written?
You may want to take a look at the Tox System Overview and the related explanations in the Tox documentation.
Okay, thanks. I'd still welcome a direct test of pip install pysnooper. Low priority.
On Ubuntu/Raspbian, pip install pysnooper shoots the following:
pi@raspberrypi:~ $ pip3 install pysnooper Downloading/unpacking pysnooper Downloading PySnooper-0.0.22-py2.py3-none-any.whl Installing collected packages: pysnooper Cleaning up... Exception: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 295, in run requirement_set.install(install_options, global_options, root=options.root_path) File "/usr/lib/python3/dist-packages/pip/req.py", line 1436, in install requirement.install(install_options, global_options, *args, **kwargs) File "/usr/lib/python3/dist-packages/pip/req.py", line 672, in install self.move_wheel_files(self.source_dir, root=root) File "/usr/lib/python3/dist-packages/pip/req.py", line 902, in move_wheel_files pycompile=self.pycompile, File "/usr/lib/python3/dist-packages/pip/wheel.py", line 214, in move_wheel_files clobber(source, lib_dir, True) File "/usr/lib/python3/dist-packages/pip/wheel.py", line 204, in clobber os.makedirs(destdir) File "/usr/lib/python3.4/os.py", line 237, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-packages/pysnooper'
Storing debug log for failure in /home/pi/.pip/pip.log
All this on a Rasbberry Pi
@enadol :
- Please move this to a new issue.
- Please confirm that you can install other packages via pip, and show the output
On a Windows machine with Anaconda, pip install pysnooper worked just fine:

I posted these messages in response to the request of testing pip install pysnooper. I wasn't trying to report the issue in Ubuntu per se. Sorry if it bothered.
@enadol: This behavior is normal on any GNU/Linux system.
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-packages/pysnooper'
The error says, you - user pi - are not allowed to write in areas that require elevated privileges (read: administrator access, i.e. root). Note that this is fine, it makes it more difficult for attackers that manage to enter your Raspberry Pi via an unprivileged account to do harm to your machine.
On Windows you may be used to work with an administrator-level user. This allows you to install programs anywhere, which makes your system insecure by default.
TL;DR - How install a Python package?
You have two options to install Python packages on GNU/Linux. As a super-user or in your userspace.
$ sudo pip3 install pysnooper
This will prompt you for your user password (and requires the user to be in the sudo group). If sudo is not installed use su and enter the root user's password:
$ su -c "pip3 install pysnooper"
Installing in your userspace requires no special privileges:
$ pip3 install --user pysnooper
It makes packages available in ~/.local/lib/ and scripts in ~/.local/bin/ (just in case this is not in your PATH by default).
Great! Thanks a lot! Cheers!
Does anyone mind if I pick this one up? It seems like a good first issue to tackle for new contributors.
It's a difficult one. But go ahead.
On Mon, Apr 29, 2019, 07:00 Brian Thompson [email protected] wrote:
Does anyone mind if I pick this one up? It seems like a good first issue to tackle for new contributors.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cool-RR/PySnooper/issues/39#issuecomment-487446109, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAN3SSVW6VOQCAOF6BUXGDPSZXE5ANCNFSM4HICWKLQ .
With the existing automation that's already in place with tox and travis, I think the solution was easier to implement than originally thought--unless I'm missing something?