From 642fd8068b170f7c6c6205f39a65f45b6d70b75f Mon Sep 17 00:00:00 2001 From: ilyavasilev Date: Tue, 28 Nov 2023 22:12:09 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BD=D0=B5=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=82=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=BE=D0=B2.=20=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=B8=D0=BB=20README.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 31 ++++++++++++++++++- scada_system/README.md | 24 -------------- scada_system/tests/__init__.py | 0 scada_system/tests/controls/__init__.py | 0 scada_system/tests/controls/test_device.py | 4 ++- scada_system/tests/equipment/__init__.py | 0 .../tests/equipment/test_turtle_device.py | 7 ++++- 7 files changed, 39 insertions(+), 27 deletions(-) delete mode 100644 scada_system/README.md create mode 100644 scada_system/tests/__init__.py create mode 100644 scada_system/tests/controls/__init__.py create mode 100644 scada_system/tests/equipment/__init__.py diff --git a/README.md b/README.md index b6cee21..2653974 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,31 @@ -# advanced-python-homework-2023 +## advanced-python-homework-2023 +## Installation + +1. Install `Python` + +2. Install `python3-venv` by the following command: `apt install python3-venv` + +3. Create and activate your virtual environment following the [instructions](https://docs.python.org/3/tutorial/venv.html) + +4. Install the `requirements.txt` dependencies following the commands: +``` +cd ./scada_system +pip3 install -r requirements.txt +``` + +5. Install the package in editable mode: +``` +pip3 install -e . +``` + +6. To generate documentation in HTML format, you need to run the following commands: +``` +cd ./docs +make html +``` +## Tests +1. To run the tests, go to the `scada_system` directory and run the following command: +``` +python3 -m unittest +``` \ No newline at end of file diff --git a/scada_system/README.md b/scada_system/README.md deleted file mode 100644 index 5fd788a..0000000 --- a/scada_system/README.md +++ /dev/null @@ -1,24 +0,0 @@ -## Installation - -1. Install `Python` - -2. Install `python3-venv` by the following command: `apt install python3-venv` - -3. Create and activate your virtual environment following the [instructions](https://docs.python.org/3/tutorial/venv.html) - -4. Install the `requirements.txt` dependencies following the commands: -``` -cd ./scada_system -pip3 install -r requirements.txt -``` - -5. Install the package in editable mode: -``` -pip3 install -e . -``` - -6. To generate documentation in HTML format, you need to run the following commands: -``` -cd ./docs -make html -``` \ No newline at end of file diff --git a/scada_system/tests/__init__.py b/scada_system/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scada_system/tests/controls/__init__.py b/scada_system/tests/controls/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scada_system/tests/controls/test_device.py b/scada_system/tests/controls/test_device.py index 51249ad..a438303 100644 --- a/scada_system/tests/controls/test_device.py +++ b/scada_system/tests/controls/test_device.py @@ -9,4 +9,6 @@ class DeviceLifecycleStateTest(TestCase): pass def test_enum(self): - self.assertEqual(DeviceLifecycleStateTest["INIT"], DeviceLifecycleStateTest.INIT) + self.assertEqual(DeviceLifecycleState["INIT"], DeviceLifecycleState.INIT) + self.assertEqual(DeviceLifecycleState["OPEN"], DeviceLifecycleState.OPEN) + self.assertEqual(DeviceLifecycleState["CLOSE"], DeviceLifecycleState.CLOSE) diff --git a/scada_system/tests/equipment/__init__.py b/scada_system/tests/equipment/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scada_system/tests/equipment/test_turtle_device.py b/scada_system/tests/equipment/test_turtle_device.py index a12912b..4ddbfc5 100644 --- a/scada_system/tests/equipment/test_turtle_device.py +++ b/scada_system/tests/equipment/test_turtle_device.py @@ -1,5 +1,4 @@ from unittest import TestCase - from equipment.turtle_device import TurtleDevice @@ -10,4 +9,10 @@ class TurtleDeviceTest(TestCase): def test_open(self): self.device.open() + self.device.execute('forward', 100) + self.device.execute('left', 90) + self.device.execute('right', 90) + self.device.execute('color', 'red') + self.device.execute('circle', 120, 180) + self.device.execute('home') self.device.close() \ No newline at end of file