From 62b585644d131b2eb34028943f62075b22033275 Mon Sep 17 00:00:00 2001 From: Neil Crosby Date: Tue, 23 Oct 2018 20:45:34 +0100 Subject: [PATCH] Use tox-venv to allow tests to run on OSX (#131) Installing `tox-venv` on OSX allows `tox` tests to be run, per https://community.home-assistant.io/t/installing-hass-on-macos-osx/69292 Alternatively, `tox-venv` _could_ be added directly into the https://github.com/home-assistant/home-assistant/blob/dev/script/bootstrap file, but since nobody outside of OSX developers seem to be having this problem it seemed safer to simply note it in the documentation. Without installing `tox-venv` the following occurs: ERROR: invocation failed (exit code 100), logfile: /Users/neilcrosby/Documents/git-projects.nosync/home-assistant/.tox/py37/log/py37-0.log ERROR: actionid: py37 msg: getenv cmdargs: '/Users/neilcrosby/Documents/git-projects.nosync/home-assistant/bin/python3 -m virtualenv --python /Users/neilcrosby/Documents/git-projects.nosync/home-assistant/bin/python3 py37' /Users/neilcrosby/Documents/git-projects.nosync/home-assistant/lib/python3.7/site-packages/virtualenv.py:1041: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp Already using interpreter /Users/neilcrosby/Documents/git-projects.nosync/home-assistant/bin/python3 Using base prefix '/usr/local/bin/../Cellar/python/3.7.0/bin/../Frameworks/Python.framework/Versions/3.7' New python executable in /Users/neilcrosby/Documents/git-projects.nosync/home-assistant/.tox/py37/bin/python3 Also creating executable in /Users/neilcrosby/Documents/git-projects.nosync/home-assistant/.tox/py37/bin/python ERROR: The executable /Users/neilcrosby/Documents/git-projects.nosync/home-assistant/.tox/py37/bin/python3 is not functioning ERROR: It thinks sys.prefix is '/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7' (should be '/Users/neilcrosby/Documents/git-projects.nosync/home-assistant/.tox/py37') ERROR: virtualenv is not compatible with this system or executable ERROR: Error creating virtualenv. Note that some special characters (e.g. ':' and unicode symbols) in paths are not supported by virtualenv. Error details: InvocationError('/Users/neilcrosby/Documents/git-projects.nosync/home-assistant/bin/python3 -m virtualenv --python /Users/neilcrosby/Documents/git-projects.nosync/home-assistant/bin/python3 py37 (see /Users/neilcrosby/Documents/git-projects.nosync/home-assistant/.tox/py37/log/py37-0.log)', 100) --- docs/development_testing.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/development_testing.md b/docs/development_testing.md index 64cdc211..151bb359 100644 --- a/docs/development_testing.md +++ b/docs/development_testing.md @@ -18,6 +18,8 @@ Running Tox will run unit tests against the locally available Pythons, as well a Tox uses virtual environments under the hood to create isolated testing environments. The tox virtual environments will get out-of-date when requirements change, causing test errors. Run `tox -r` to tell Tox to recreate the virtual environments. +OSX users may see an `Error creating virtualenv` when runnng `tox`. If this occurs, install the [tox-venv](https://pypi.org/project/tox-venv/) package using the command `pip install tox-venv` and try again. + ### Adding new dependencies to test environment If you are working on tests for a component or platform and you need the dependencies available inside the Tox environment, update the list inside `script/gen_requirements_all.py`. Then run the script and then run `tox -r` to recreate the virtual environments.