These are chat archives for cherrypy/cherrypy

7th
Feb 2018
Michel Normand
@michelmno
Feb 07 2018 09:32 UTC
Hi there, I did a git clone of cherrypy and tried "python -m pytest cherrypy/test" that failed with "pytest.py: error: unrecognized arguments: --cov=cherrypy --cov-report --cov-report xml cherrypy/test" how to investigate what is my problem ?
Sviatoslav Sydorenko
@webknjaz
Feb 07 2018 10:04 UTC
@michelmno install testing extras. also, it's useful to just use tox
Michel Normand
@michelmno
Feb 07 2018 10:09 UTC
@webknjaz thank you for the answer, I am a newbie, what is "testing extras" to install ?
Michel Normand
@michelmno
Feb 07 2018 10:21 UTC
I tried with tox but same failure http://susepaste.org/view/raw/20667743
Sviatoslav Sydorenko
@webknjaz
Feb 07 2018 10:26 UTC
what's your version of tox and setuptools? also what python version do you use?
so I guess you're using some outdated version of it not supporting this feature
extras are basically optional runtime dependencies aka feature flags
you'd normally do pip install cherrypy[testing] to install deps from that list additionally. but tox is setting up a virtualenv with an isolated test env and run tests there
Sviatoslav Sydorenko
@webknjaz
Feb 07 2018 10:32 UTC
@michelmno
Michel Normand
@michelmno
Feb 07 2018 11:17 UTC
@webknjaz thank you for the help :)
tox --version => 2.9.1 imported from /usr/lib/python3.4/site-packages/tox/init.py
I have both python2.7 and python3, but tox seems to use python3, after pip install cherrypy[testing] tox seems to continue and ultimately hung :( http://susepaste.org/view/raw/87247290
Sviatoslav Sydorenko
@webknjaz
Feb 07 2018 11:32 UTC
you shouldn't need to install extras outside of tox
pytest and all other extras should be installed by tox into its virtualenv
Sviatoslav Sydorenko
@webknjaz
Feb 07 2018 11:55 UTC
alternatively, you should be able to create a virtualenv manually, activate it, install everything inside of it and run pytest there
git clone...
cd cherrypy
virtualenv -p python3.6 env
. env/bin/activate
pip install -e .[testing]
pytest
But I normally manage my pythons using pyenv, so that I'm completely isolated from OS-managed packages
there's also an option to use containers (like docker) for isolation
I normally discourage using system python install, because it involves lots of moving parts, and you normally don't want some third party to influence your env
Sviatoslav Sydorenko
@webknjaz
Feb 07 2018 12:13 UTC
@michelmno oh.. your last error in tests with OSError happens because of the lack of support for IPv6
but anyway I encourage you to have isolated environments for python projects
Michel Normand
@michelmno
Feb 07 2018 12:23 UTC
@webknjaz thank you for the suggestion of virtualenv, I just tried it :) and as suggested I do not have anymore problem with pytest from /usr/bin/pytest.
The OSError and lack of support of IPv6, could we have the test to be skipped automatically ?
Despite the virtualenv I still have the test blocked on "StaticTest.test_unicode"
Sviatoslav Sydorenko
@webknjaz
Feb 07 2018 12:26 UTC
ipv6 issue is actually specific to your setup: /etc/hosts pointing localhost to ::1, while you have ipv6 disabled in sysctl, but enabled in kernel. it's not possible to disable that test, but you can choose which test to run via -k option of pytest
normally, localhost should've been resolved to 127.0.0.1 instead (since you don't seem to use IPv4)
some tests are unstable and it's legacy from a decade ago
lots of things should be fixed when we completely migrate from unittest testcases to pytest fixtures, which is a bit hard. I've only managed to migrate Cheroot test suite recently, which currently still needs bits of improvements.
Michel Normand
@michelmno
Feb 07 2018 12:32 UTC
Is there an easy way to skip some specific tests from pytest ? (rather than to give list of tests to run)
Sviatoslav Sydorenko
@webknjaz
Feb 07 2018 12:33 UTC
I don't remember one. You should consult with pytest --help and official docs of this runner
it is normally possible to use marks, but that one is probably not marked
I've just realised that static tests being stuck might be related to cherrypy/cherrypy#1690 / cherrypy/cherrypy#1692
/cc: @jaraco
Jason R. Coombs
@jaraco
Feb 07 2018 12:49 UTC
I just gave CherryPy the minversion=2.4 to the tox.ini. https://gist.github.com/cf95de7c74d39d86d633761de2af61f3
You can skip tests with -k “not something”
Sviatoslav Sydorenko
@webknjaz
Feb 07 2018 12:51 UTC
yea, I've been thinking of doing the same. but current issue is that it's really frustrating to see test for static being stuck only if you run full testsuite, so that it's likely affected by smth like state tests
Jason R. Coombs
@jaraco
Feb 07 2018 12:51 UTC
I’d be surprised if there’s a test capturing #1692 - as that’s a pretty specific use case.
Sviatoslav Sydorenko
@webknjaz
Feb 07 2018 12:53 UTC
it just looks like that ticket describes "almost stuck" static and existing tests for static are "completely stuck". feels similar, but not necessarily related