test(ocpp-server): add tasks to format/lint code
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 12 Jun 2024 18:30:20 +0000 (20:30 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 12 Jun 2024 18:30:20 +0000 (20:30 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
e-mobility-charging-stations-simulator.code-workspace
tests/ocpp-server/README.md
tests/ocpp-server/poetry.lock
tests/ocpp-server/pyproject.toml

index a08e71ee4ee98985661b8042db98cf1b1d955856..06cb8f27ee839a9b00f1d1f220bffd09ff05e559 100644 (file)
@@ -5,6 +5,9 @@
     },
     {
       "path": "ui/web"
     },
     {
       "path": "ui/web"
+    },
+    {
+      "path": "tests/ocpp-server"
     }
   ],
   "settings": {
     }
   ],
   "settings": {
index 332751d564533331cc43d066ca343ec15a16d231..e2a8149c90de427c31db970401e41df9f69377e0 100644 (file)
@@ -6,7 +6,7 @@ This project includes an Open Charge Point Protocol (OCPP) version 2.0.1 mock se
 
 This project requires Python 3.7+ and [poetry](https://python-poetry.org/) to install the required packages:
 
 
 This project requires Python 3.7+ and [poetry](https://python-poetry.org/) to install the required packages:
 
-```
+```shell
 poetry install
 ```
 
 poetry install
 ```
 
@@ -14,7 +14,7 @@ poetry install
 
 To start the server, run the `server.py` script:
 
 
 To start the server, run the `server.py` script:
 
-```
+```shell
 python server.py
 ```
 
 python server.py
 ```
 
@@ -28,6 +28,20 @@ The server script waits for connections from clients. When a client connects, th
 
 The server script uses the websockets and ocpp libraries to facilitate the WebSocket and OCPP communication.
 
 
 The server script uses the websockets and ocpp libraries to facilitate the WebSocket and OCPP communication.
 
+## Development
+
+### Code formatting
+
+```shell
+poetry run task format
+```
+
+### Code linting
+
+```shell
+poetry run task lint
+```
+
 ## Note
 
 Primarily, this software is intended for testing applications. The server script don't adhere to the full OCPP specifications and it is advised not to use them in a production environment without additional development.
 ## Note
 
 Primarily, this software is intended for testing applications. The server script don't adhere to the full OCPP specifications and it is advised not to use them in a production environment without additional development.
index a7ff07e3173de29b40e141f7b1672807411d08e7..bdf37b8cd95baf6cfed78d2458265e745b166d40 100644 (file)
@@ -164,6 +164,17 @@ files = [
     {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"},
 ]
 
     {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"},
 ]
 
+[[package]]
+name = "mslex"
+version = "1.2.0"
+description = "shlex for windows"
+optional = false
+python-versions = ">=3.5"
+files = [
+    {file = "mslex-1.2.0-py3-none-any.whl", hash = "sha256:c68ec637485ee3544c5847c1b4e78b02940b32708568fb1d8715491815aa2341"},
+    {file = "mslex-1.2.0.tar.gz", hash = "sha256:79e2abc5a129dd71cdde58a22a2039abb7fa8afcbac498b723ba6e9b9fbacc14"},
+]
+
 [[package]]
 name = "mypy-extensions"
 version = "1.0.0"
 [[package]]
 name = "mypy-extensions"
 version = "1.0.0"
@@ -227,6 +238,34 @@ docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-
 test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"]
 type = ["mypy (>=1.8)"]
 
 test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"]
 type = ["mypy (>=1.8)"]
 
+[[package]]
+name = "psutil"
+version = "5.9.8"
+description = "Cross-platform lib for process and system monitoring in Python."
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
+files = [
+    {file = "psutil-5.9.8-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:26bd09967ae00920df88e0352a91cff1a78f8d69b3ecabbfe733610c0af486c8"},
+    {file = "psutil-5.9.8-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:05806de88103b25903dff19bb6692bd2e714ccf9e668d050d144012055cbca73"},
+    {file = "psutil-5.9.8-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:611052c4bc70432ec770d5d54f64206aa7203a101ec273a0cd82418c86503bb7"},
+    {file = "psutil-5.9.8-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:50187900d73c1381ba1454cf40308c2bf6f34268518b3f36a9b663ca87e65e36"},
+    {file = "psutil-5.9.8-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:02615ed8c5ea222323408ceba16c60e99c3f91639b07da6373fb7e6539abc56d"},
+    {file = "psutil-5.9.8-cp27-none-win32.whl", hash = "sha256:36f435891adb138ed3c9e58c6af3e2e6ca9ac2f365efe1f9cfef2794e6c93b4e"},
+    {file = "psutil-5.9.8-cp27-none-win_amd64.whl", hash = "sha256:bd1184ceb3f87651a67b2708d4c3338e9b10c5df903f2e3776b62303b26cb631"},
+    {file = "psutil-5.9.8-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:aee678c8720623dc456fa20659af736241f575d79429a0e5e9cf88ae0605cc81"},
+    {file = "psutil-5.9.8-cp36-abi3-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8cb6403ce6d8e047495a701dc7c5bd788add903f8986d523e3e20b98b733e421"},
+    {file = "psutil-5.9.8-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d06016f7f8625a1825ba3732081d77c94589dca78b7a3fc072194851e88461a4"},
+    {file = "psutil-5.9.8-cp36-cp36m-win32.whl", hash = "sha256:7d79560ad97af658a0f6adfef8b834b53f64746d45b403f225b85c5c2c140eee"},
+    {file = "psutil-5.9.8-cp36-cp36m-win_amd64.whl", hash = "sha256:27cc40c3493bb10de1be4b3f07cae4c010ce715290a5be22b98493509c6299e2"},
+    {file = "psutil-5.9.8-cp37-abi3-win32.whl", hash = "sha256:bc56c2a1b0d15aa3eaa5a60c9f3f8e3e565303b465dbf57a1b730e7a2b9844e0"},
+    {file = "psutil-5.9.8-cp37-abi3-win_amd64.whl", hash = "sha256:8db4c1b57507eef143a15a6884ca10f7c73876cdf5d51e713151c1236a0e68cf"},
+    {file = "psutil-5.9.8-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:d16bbddf0693323b8c6123dd804100241da461e41d6e332fb0ba6058f630f8c8"},
+    {file = "psutil-5.9.8.tar.gz", hash = "sha256:6be126e3225486dff286a8fb9a06246a5253f4c7c53b475ea5f5ac934e64194c"},
+]
+
+[package.extras]
+test = ["enum34", "ipaddress", "mock", "pywin32", "wmi"]
+
 [[package]]
 name = "pycodestyle"
 version = "2.11.1"
 [[package]]
 name = "pycodestyle"
 version = "2.11.1"
@@ -372,6 +411,34 @@ files = [
     {file = "rpds_py-0.18.1.tar.gz", hash = "sha256:dc48b479d540770c811fbd1eb9ba2bb66951863e448efec2e2c102625328e92f"},
 ]
 
     {file = "rpds_py-0.18.1.tar.gz", hash = "sha256:dc48b479d540770c811fbd1eb9ba2bb66951863e448efec2e2c102625328e92f"},
 ]
 
+[[package]]
+name = "taskipy"
+version = "1.12.2"
+description = "tasks runner for python projects"
+optional = false
+python-versions = ">=3.6,<4.0"
+files = [
+    {file = "taskipy-1.12.2-py3-none-any.whl", hash = "sha256:ffdbb0bb0db54c0ec5c424610a3a087eea22706d4d1f6e3e8b4f12ebba05f98f"},
+    {file = "taskipy-1.12.2.tar.gz", hash = "sha256:eadfdc20d6bb94d8018eda32f1dbf584cf4aa6cffb71ba5cc2de20d344f8c4fb"},
+]
+
+[package.dependencies]
+colorama = ">=0.4.4,<0.5.0"
+mslex = {version = ">=1.1.0,<2.0.0", markers = "sys_platform == \"win32\""}
+psutil = ">=5.7.2,<6.0.0"
+tomli = {version = ">=2.0.1,<3.0.0", markers = "python_version >= \"3.7\" and python_version < \"4.0\""}
+
+[[package]]
+name = "tomli"
+version = "2.0.1"
+description = "A lil' TOML parser"
+optional = false
+python-versions = ">=3.7"
+files = [
+    {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
+    {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
+]
+
 [[package]]
 name = "websockets"
 version = "12.0"
 [[package]]
 name = "websockets"
 version = "12.0"
@@ -456,4 +523,4 @@ files = [
 [metadata]
 lock-version = "2.0"
 python-versions = "^3.12"
 [metadata]
 lock-version = "2.0"
 python-versions = "^3.12"
-content-hash = "1967ea6a8bdd559c8d930e2948996f1cd701e9c6f83b4fa17b86a05972b01817"
+content-hash = "a5e4f3f79d6837130dce01c7689d462a7008be093ec9c2cbcd3298b9c1c57539"
index 1c8cc8ca1b6c70dd9fc99e5ac013e49b9ee9cf42..88c09f88e83663a9b10378c78df1667f534e78ee 100644 (file)
@@ -10,11 +10,16 @@ python = "^3.12"
 websockets = "^12.0"
 ocpp = "^2.0.0rc1"
 
 websockets = "^12.0"
 ocpp = "^2.0.0rc1"
 
-[tool.poetry.group.development.dependencies]
+[tool.poetry.group.dev.dependencies]
+taskipy = "^1"
 isort = "^5"
 black = "^24"
 flake8 = "^7"
 
 isort = "^5"
 black = "^24"
 flake8 = "^7"
 
+[tool.taskipy.tasks]
+format = "black . && isort ."
+lint = "flake8 ."
+
 [tool.isort]
 profile = 'black'
 
 [tool.isort]
 profile = 'black'