adaptive-lighting/tests
Benjamin Auquite 7895075e76 Squashed commit of the following:
commit 7069d693b8
Merge: adde5b5 a888afd
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 12:52:19 2023 -0500

    Merge branch 'main' into add-watched-lights

commit adde5b5645
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 10:34:24 2023 -0500

    fix pytest

commit 2c5eaec2d3
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 07:27:25 2023 -0500

    Revert "Update const.py"

    This reverts commit e773af07ca.

commit e773af07ca
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 07:20:23 2023 -0500

    Update const.py

commit c167f59ccd
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 06:09:14 2023 -0500

    Update docs

commit 6220df57d1
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:59:26 2023 -0500

    fix the test

commit ff292c2c1b
Merge: 4fdf42b 19d4468
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:39:17 2023 -0500

    Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights

commit 4fdf42bea1
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:39:05 2023 -0500

    small fixes

commit 19d4468f63
Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Date:   Mon Apr 10 10:36:54 2023 +0000

    Update README.md, strings.json, and services.yaml

commit 70c90181f0
Merge: e30b7de b6a9265
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 10:34:49 2023 +0000

    Merge b6a92650a9 into e30b7debe5

commit b6a92650a9
Merge: 784eed0 ae04ab4
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:34:43 2023 -0500

    Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights

commit 784eed09b3
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:34:33 2023 -0500

    squash merge `alt_detect_method` again

commit ae04ab49a8
Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Date:   Mon Apr 10 10:34:12 2023 +0000

    Update README.md, strings.json, and services.yaml

commit cfbd65f976
Merge: e30b7de 3c5ea73
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 10:32:34 2023 +0000

    Merge 3c5ea73341 into e30b7debe5

commit 3c5ea73341
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:32:27 2023 -0500

    Update switch.py

commit 2f750694d9
Merge: 429251b 7a9dc8f
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:31:13 2023 -0500

    Merge branch 'add-watched-lights' of https://github.com/basnijholt/adaptive-lighting into add-watched-lights

commit 429251b45f
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:31:04 2023 -0500

    update docs

commit 7a9dc8f24a
Author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Date:   Mon Apr 10 10:29:37 2023 +0000

    Update README.md, strings.json, and services.yaml

commit 37de4244b1
Merge: e30b7de d52ea53
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 10:28:01 2023 +0000

    Merge d52ea53dcc into e30b7debe5

commit d52ea53dcc
Merge: dbc47c8 e30b7de
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:27:43 2023 -0500

    Merge branch 'main' into add-watched-lights

commit dbc47c8a36
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:26:11 2023 -0500

    Update switch.py

commit 2db675a434
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:25:44 2023 -0500

    merge with `alt_detect_method`

    required for this PR

commit dced97b5ca
Author: Benjamin Auquite <halomastar@gmail.com>
Date:   Mon Apr 10 05:21:51 2023 -0500

    merge with `origin\main`
2023-04-11 19:08:49 -05:00
..
__init__.py Copy tests from https://github.com/home-assistant/core/pull/40626 2022-08-28 12:05:31 -07:00
README.md Fix the docker tests instructions (#543) 2023-04-05 09:13:57 -07:00
test_config_flow.py Try to copy over files 2022-08-28 13:42:55 -07:00
test_init.py Fix test_successful_config_entry and test_unload_entry 2022-08-28 14:30:24 -07:00
test_switch.py Squashed commit of the following: 2023-04-11 19:08:49 -05:00

Developer notes for the tests directory

To run the tests, check out the CI configuration to see how they are executed in the CI pipeline. Alternatively, you can use the provided Docker image to run the tests locally.

To run the tests using the Docker image, navigate to the adaptive-lighting repo folder and execute the following command:

Linux / MacOS / Windows PowerShell:

docker run -v ${PWD}:/app basnijholt/adaptive-lighting:latest
  • In windows command prompt, the command is:
    docker run -v %cd%:/app basnijholt/adaptive-lighting:latest
    

This command will download the Docker image from the adaptive-lighting Docker Hub repo and run the tests.

If you prefer to build the image yourself, use the following command:

docker build -t basnijholt/adaptive-lighting:latest --no-cache .

This might be necessary if the image on Docker Hub is outdated or if the test_dependencies.py file is updated.

Passing arguments to pytest

You can pass arguments to pytest by appending them to the command:

For example, to run the tests with a custom log format, use the following command (this also gets rid of the captured stderr output):

docker run -v $(pwd):/app basnijholt/adaptive-lighting:latest --show-capture=log --log-format="%(asctime)s %(levelname)-8s %(name)s:%(filename)s:%(lineno)s %(message)s" --log-date-format="%H:%M:%S" tests/components/adaptive_lighting/