From daa057c708706b085f1c454c265f5500f73a8c4c Mon Sep 17 00:00:00 2001 From: YS Date: Thu, 6 Jan 2022 16:59:31 +0300 Subject: [PATCH] remove local tests --- frigate/test/README.md | 20 -------------------- frigate/test/conftest.py | 26 -------------------------- frigate/test/requirements.test.txt | 17 ----------------- tox.ini | 14 -------------- 4 files changed, 77 deletions(-) delete mode 100644 frigate/test/README.md delete mode 100644 frigate/test/conftest.py delete mode 100644 frigate/test/requirements.test.txt delete mode 100644 tox.ini diff --git a/frigate/test/README.md b/frigate/test/README.md deleted file mode 100644 index 6634060ec..000000000 --- a/frigate/test/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Running unit tests from devcontainer -If you're using devcontainer, you can use the following command to run unit tests: -``` -python3 -m unittest -``` - -# Running unit tests locally -Local development might be a bit trickier. The frigate has a defaults, which are not compatible with the local setup. For instance, `/labelmap.txt` should be located in the root. - -To run unit tests, you can use `tox`. - -### Prerequisites -Make sure you have python3.8 installed in your system. You also might need to install `python3.8-dev` package -``` -sudo apt-get update && sudo apt-get install -y python3.8 python3.8-dev -``` - -### Running tests -To run tests, use `tox -e unittests` command. -`tox` uses pytest runner and rely on `conftest.py` to mock some of the modules and mock builtins.open to read the `/labelmap.txt` file. \ No newline at end of file diff --git a/frigate/test/conftest.py b/frigate/test/conftest.py deleted file mode 100644 index 5b8986f62..000000000 --- a/frigate/test/conftest.py +++ /dev/null @@ -1,26 +0,0 @@ -import pytest -from unittest import mock -import sys - -def fake_open(filename, *args, **kvargs): - if filename == '/labelmap.txt': - content = "0 person\n1 bicycle" - else: - raise FileNotFoundError(filename) - file_object = mock.mock_open(read_data=content).return_value - file_object.__iter__.return_value = content.splitlines(True) - return file_object - -@pytest.fixture(scope="session", autouse=True) -def filesystem_mock(): - with mock.patch("builtins.open", new=fake_open, create=True): - yield - -# monkeypatch tflite_runtime -# in case of moving to the pytest completely, this can be done in more pyhonic way -module = type(sys)('tflite_runtime') -sys.modules['tflite_runtime'] = module - -module = type(sys)('tflite_runtime.interpreter') -module.load_delegate = mock.MagicMock() -sys.modules['tflite_runtime.interpreter'] = module diff --git a/frigate/test/requirements.test.txt b/frigate/test/requirements.test.txt deleted file mode 100644 index 910e0ab0b..000000000 --- a/frigate/test/requirements.test.txt +++ /dev/null @@ -1,17 +0,0 @@ -opencv-python-headless -numpy -imutils -scipy -psutil -Flask -paho-mqtt -PyYAML -matplotlib -click -setproctitle -peewee -peewee_migrate -pydantic -zeroconf -ws4py -pytest \ No newline at end of file diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 3b2a495ea..000000000 --- a/tox.ini +++ /dev/null @@ -1,14 +0,0 @@ -[tox] -envlist = py38 -skipsdist = true - -[testenv] -install_command = pip install {opts} {packages} -basepython= python3.8 - -[testenv:unittests] -deps = - -rfrigate/test/requirements.test.txt - pytest - -commands = python3.8 -m pytest -svv