diff --git a/atom.xml b/atom.xml index 17ba506105..969809f93b 100644 --- a/atom.xml +++ b/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/announcements/atom.xml b/blog/categories/announcements/atom.xml index eea449786a..bb39988227 100644 --- a/blog/categories/announcements/atom.xml +++ b/blog/categories/announcements/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Announcements | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/community/atom.xml b/blog/categories/community/atom.xml index d97b65983d..74874bf340 100644 --- a/blog/categories/community/atom.xml +++ b/blog/categories/community/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Community | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/device-tracking/atom.xml b/blog/categories/device-tracking/atom.xml index cf4d1eb460..18e554ec9b 100644 --- a/blog/categories/device-tracking/atom.xml +++ b/blog/categories/device-tracking/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Device-Tracking | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/esp8266/atom.xml b/blog/categories/esp8266/atom.xml index b3400bcd99..2a3c0645f5 100644 --- a/blog/categories/esp8266/atom.xml +++ b/blog/categories/esp8266/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: ESP8266 | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/how-to/atom.xml b/blog/categories/how-to/atom.xml index 434629e8ed..3b8d22285d 100644 --- a/blog/categories/how-to/atom.xml +++ b/blog/categories/how-to/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: How-To | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/ibeacons/atom.xml b/blog/categories/ibeacons/atom.xml index 2f8817c046..06b685d37f 100644 --- a/blog/categories/ibeacons/atom.xml +++ b/blog/categories/ibeacons/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: iBeacons | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/internet-of-things/atom.xml b/blog/categories/internet-of-things/atom.xml index 1edb56b9f7..dbdb36841c 100644 --- a/blog/categories/internet-of-things/atom.xml +++ b/blog/categories/internet-of-things/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Internet-of-Things | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/iot-data/atom.xml b/blog/categories/iot-data/atom.xml index 8e2499fb61..26aad44844 100644 --- a/blog/categories/iot-data/atom.xml +++ b/blog/categories/iot-data/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: IoT-Data | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/merchandise/atom.xml b/blog/categories/merchandise/atom.xml index 0add946280..ffc5248a75 100644 --- a/blog/categories/merchandise/atom.xml +++ b/blog/categories/merchandise/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Merchandise | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/micropython/atom.xml b/blog/categories/micropython/atom.xml index d891247a9b..dffbb4d8ae 100644 --- a/blog/categories/micropython/atom.xml +++ b/blog/categories/micropython/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Micropython | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/mqtt/atom.xml b/blog/categories/mqtt/atom.xml index 0028209ee3..e482e22c8b 100644 --- a/blog/categories/mqtt/atom.xml +++ b/blog/categories/mqtt/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: MQTT | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/organisation/atom.xml b/blog/categories/organisation/atom.xml index f7d6555304..8627507daa 100644 --- a/blog/categories/organisation/atom.xml +++ b/blog/categories/organisation/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Organisation | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/owntracks/atom.xml b/blog/categories/owntracks/atom.xml index 62cb398c98..d41097ef8c 100644 --- a/blog/categories/owntracks/atom.xml +++ b/blog/categories/owntracks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: OwnTracks | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/presence-detection/atom.xml b/blog/categories/presence-detection/atom.xml index e2cd26c1f1..3efa9d35b6 100644 --- a/blog/categories/presence-detection/atom.xml +++ b/blog/categories/presence-detection/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Presence-Detection | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/public-service-announcement/atom.xml b/blog/categories/public-service-announcement/atom.xml index ff3adf40d1..47bcaae738 100644 --- a/blog/categories/public-service-announcement/atom.xml +++ b/blog/categories/public-service-announcement/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Public-Service-Announcement | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/release-notes/atom.xml b/blog/categories/release-notes/atom.xml index ec26b3038e..3413556b14 100644 --- a/blog/categories/release-notes/atom.xml +++ b/blog/categories/release-notes/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Release-Notes | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/survey/atom.xml b/blog/categories/survey/atom.xml index c050048fca..8fa3001db6 100644 --- a/blog/categories/survey/atom.xml +++ b/blog/categories/survey/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Survey | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/talks/atom.xml b/blog/categories/talks/atom.xml index 2a6dbea618..0c701a89b3 100644 --- a/blog/categories/talks/atom.xml +++ b/blog/categories/talks/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Talks | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/technology/atom.xml b/blog/categories/technology/atom.xml index 157a607159..ccb8169e2e 100644 --- a/blog/categories/technology/atom.xml +++ b/blog/categories/technology/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Technology | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/user-stories/atom.xml b/blog/categories/user-stories/atom.xml index 36637f0013..ab6eca91db 100644 --- a/blog/categories/user-stories/atom.xml +++ b/blog/categories/user-stories/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: User-Stories | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/video/atom.xml b/blog/categories/video/atom.xml index f8708a31fb..0b35b2d12c 100644 --- a/blog/categories/video/atom.xml +++ b/blog/categories/video/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Video | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/blog/categories/website/atom.xml b/blog/categories/website/atom.xml index 9fd8f63684..f30998c497 100644 --- a/blog/categories/website/atom.xml +++ b/blog/categories/website/atom.xml @@ -4,7 +4,7 @@ <![CDATA[Category: Website | Home Assistant]]> - 2017-05-14T00:53:58+00:00 + 2017-05-14T04:26:52+00:00 https://home-assistant.io/ diff --git a/developers/development_testing/index.html b/developers/development_testing/index.html index 5ebcc0cd91..b743bef2f8 100644 --- a/developers/development_testing/index.html +++ b/developers/development_testing/index.html @@ -66,21 +66,20 @@
-

As states in the Style guidelines section all code is checked as part of the linting process and unit test were run.

-

Local testing

-

Important: Run tox before you create your pull request to avoid annoying fixes. Local testing requires installing tox.

-
$ pip3 install tox
-
-
-

Start your code test with tox.

+

As states in the Style guidelines section all code is checked to verify all unit tests pass and that the code passes the linting tools. Local testing is done using Tox, which has been installed as part of running script/setup. To start the tests, simply run it:

$ tox
 
-

This will run unit tests against Python 3.4 and 3.5 (if both are available locally), as well as tests that validate pep8 and pylint style.

-

Testing Tips

-

You can run tests on only one tox target – just use -e to select an environment. For example, tox -e lint runs the linters only, and tox -e py34 runs unit tests only on Python 3.4.

-

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 create new tox virtual environments.

-

During development on a specific file, speed up your workflow by running tests and linting only for the file that you’re working on. To run individual files:

+

Important: Run tox before you create your pull request to avoid annoying fixes.

+

Running Tox will run unit tests against the locally available Pythons, as well as validate the code and document style using pycodestyle, pydocstyle and pylint. You can run tests on only one tox target – just use -e to select an environment. For example, tox -e lint runs the linters only, and tox -e py34 runs unit tests only on Python 3.4.

+

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.

+

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.

+

Testing single files

+

Running tox will invoke the full test suite. Even if you specify which tox target to run, you still run all tests inside that target. That’s not very convenient to quickly iterate on your code! To be able to run the specific test suites without Tox, you’ll need to install the test dependencies into your Python environment:

+
$ bash pip3 install -r requirements_test_all.txt
+
+
+

Now that you have all test dependencies installed, you can run tests on individual files:

$ flake8 homeassistant/core.py
 $ pylint homeassistant/core.py
 $ pydocstyle homeassistant/core.py
@@ -91,6 +90,18 @@
 
$ script/lint --changed
 
+

Py.test tips

+

Py.test has some great command line parameters to help you with the write-test-fix cycle.

+
# Stop after the first test fails
+$ py.test tests/test_core.py -x
+# Run test with specified name
+$ py.test tests/test_core.py -k test_split_entity_id
+# Fail a test after it runs for 2 seconds
+$ py.test tests/test_core.py --timeout 2
+# Show the 10 slowest tests
+$ py.test tests/test_core.py --duration=10
+
+

Preventing Linter Errors

Save yourself the hassle of extra commits just to fix style errors by enabling the Flake8 git commit hook. Flake8 will check your code when you try to commit to the repository and block the commit if there are any style errors, which gives you a chance to fix them!

$ pip3 install flake8 flake8-docstrings
@@ -99,7 +110,7 @@
 

The flake8-docstrings extension will check docstrings according to PEP257 when running Flake8.

Notes on PyLint and PEP8 validation

-

If you can’t avoid a PyLint warning, add a comment to disable the PyLint check for that line with # pylint: disable=YOUR-ERROR-NAME. An example of an unavoidable PyLint warning is not using the passed-in datetime if you’re listening for a time change.

+

If you can’t avoid a PyLint warning, add a comment to disable the PyLint check for that line with # pylint: disable=YOUR-ERROR-NAME. Example of an unavoidable one is if PyLint incorrectly reports that a certain object doesn’t have a certain member.