[REF] tests : passer isort et black sur trois fichiers oubliés
Trois fichiers de la suite n'étaient pas au format du dépôt : imports non triés, expressions coupées là où la ligne tient. `make format` les rattrape. Aucun test n'est ajouté, retiré ni modifié dans ce qu'il vérifie. --- EN --- Three files of the suite were not in the repository's format: unsorted imports, expressions broken where the line fits. `make format` catches them up. No test is added, removed, or changed in what it checks. Assisted-by: Claude Opus 5
This commit is contained in:
parent
bdc0e19302
commit
8181e693a2
3 changed files with 16 additions and 31 deletions
|
|
@ -6,11 +6,13 @@ import ast
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from script.code_generator.search_class_model import (
|
from script.code_generator.search_class_model import (
|
||||||
|
ARGS_TYPE_PARAM,
|
||||||
extract_lambda,
|
extract_lambda,
|
||||||
fill_search_field,
|
fill_search_field,
|
||||||
search_and_replace,
|
search_and_replace,
|
||||||
ARGS_TYPE_PARAM,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def count_space_tab(word, group_space=4):
|
def count_space_tab(word, group_space=4):
|
||||||
"""Copied from transform_python_to_code_writer (cannot import due to
|
"""Copied from transform_python_to_code_writer (cannot import due to
|
||||||
code_writer dependency not available in erplibre venv)."""
|
code_writer dependency not available in erplibre venv)."""
|
||||||
|
|
@ -152,9 +154,7 @@ class TestFillSearchField(unittest.TestCase):
|
||||||
class TestSearchAndReplace(unittest.TestCase):
|
class TestSearchAndReplace(unittest.TestCase):
|
||||||
def test_replace_quoted_value(self):
|
def test_replace_quoted_value(self):
|
||||||
content = 'template_model_name = "old_model"'
|
content = 'template_model_name = "old_model"'
|
||||||
result = search_and_replace(
|
result = search_and_replace(content, "hooks.py", "new_model")
|
||||||
content, "hooks.py", "new_model"
|
|
||||||
)
|
|
||||||
self.assertIn('"new_model"', result)
|
self.assertIn('"new_model"', result)
|
||||||
self.assertNotIn("old_model", result)
|
self.assertNotIn("old_model", result)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,26 +7,21 @@ import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
|
|
||||||
from script.docker.docker_update_version import edit_text, edit_docker_prod
|
from script.docker.docker_update_version import edit_docker_prod, edit_text
|
||||||
|
|
||||||
|
|
||||||
class TestEditText(unittest.TestCase):
|
class TestEditText(unittest.TestCase):
|
||||||
"""Test docker-compose.yml image version update."""
|
"""Test docker-compose.yml image version update."""
|
||||||
|
|
||||||
def _write_compose(self, content):
|
def _write_compose(self, content):
|
||||||
f = tempfile.NamedTemporaryFile(
|
f = tempfile.NamedTemporaryFile(mode="w", suffix=".yml", delete=False)
|
||||||
mode="w", suffix=".yml", delete=False
|
|
||||||
)
|
|
||||||
f.write(content)
|
f.write(content)
|
||||||
f.close()
|
f.close()
|
||||||
return f.name
|
return f.name
|
||||||
|
|
||||||
def test_updates_image_after_erplibre(self):
|
def test_updates_image_after_erplibre(self):
|
||||||
path = self._write_compose(
|
path = self._write_compose(
|
||||||
"services:\n"
|
"services:\n" " ERPLibre:\n" " image: old:1.0\n" " ports:\n"
|
||||||
" ERPLibre:\n"
|
|
||||||
" image: old:1.0\n"
|
|
||||||
" ports:\n"
|
|
||||||
)
|
)
|
||||||
config = SimpleNamespace(
|
config = SimpleNamespace(
|
||||||
docker_compose_file=path,
|
docker_compose_file=path,
|
||||||
|
|
@ -64,17 +59,13 @@ class TestEditDockerProd(unittest.TestCase):
|
||||||
"""Test Dockerfile.prod FROM line update."""
|
"""Test Dockerfile.prod FROM line update."""
|
||||||
|
|
||||||
def _write_dockerfile(self, content):
|
def _write_dockerfile(self, content):
|
||||||
f = tempfile.NamedTemporaryFile(
|
f = tempfile.NamedTemporaryFile(mode="w", suffix=".pkg", delete=False)
|
||||||
mode="w", suffix=".pkg", delete=False
|
|
||||||
)
|
|
||||||
f.write(content)
|
f.write(content)
|
||||||
f.close()
|
f.close()
|
||||||
return f.name
|
return f.name
|
||||||
|
|
||||||
def test_updates_from_line(self):
|
def test_updates_from_line(self):
|
||||||
path = self._write_dockerfile(
|
path = self._write_dockerfile("FROM base:old\nRUN apt-get update\n")
|
||||||
"FROM base:old\nRUN apt-get update\n"
|
|
||||||
)
|
|
||||||
config = SimpleNamespace(
|
config = SimpleNamespace(
|
||||||
docker_compose_file="unused",
|
docker_compose_file="unused",
|
||||||
docker_prod=path,
|
docker_prod=path,
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,7 @@ class TestRemoveDotPath(unittest.TestCase):
|
||||||
self.assertEqual(remove_dot_path("./"), "")
|
self.assertEqual(remove_dot_path("./"), "")
|
||||||
|
|
||||||
def test_nested_dot_slash(self):
|
def test_nested_dot_slash(self):
|
||||||
self.assertEqual(
|
self.assertEqual(remove_dot_path("./a/./b"), "a/./b")
|
||||||
remove_dot_path("./a/./b"), "a/./b"
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_empty_string(self):
|
def test_empty_string(self):
|
||||||
self.assertEqual(remove_dot_path(""), "")
|
self.assertEqual(remove_dot_path(""), "")
|
||||||
|
|
@ -75,15 +73,11 @@ class TestConstants(unittest.TestCase):
|
||||||
|
|
||||||
def test_pyproject_template(self):
|
def test_pyproject_template(self):
|
||||||
result = PYPROJECT_TEMPLATE_FILE % "odoo18.0_python3.12.10"
|
result = PYPROJECT_TEMPLATE_FILE % "odoo18.0_python3.12.10"
|
||||||
self.assertEqual(
|
self.assertEqual(result, "pyproject.odoo18.0_python3.12.10.toml")
|
||||||
result, "pyproject.odoo18.0_python3.12.10.toml"
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_poetry_lock_template(self):
|
def test_poetry_lock_template(self):
|
||||||
result = POETRY_LOCK_TEMPLATE_FILE % "odoo18.0_python3.12.10"
|
result = POETRY_LOCK_TEMPLATE_FILE % "odoo18.0_python3.12.10"
|
||||||
self.assertEqual(
|
self.assertEqual(result, "poetry.odoo18.0_python3.12.10.lock")
|
||||||
result, "poetry.odoo18.0_python3.12.10.lock"
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_addons_template(self):
|
def test_addons_template(self):
|
||||||
result = ADDONS_TEMPLATE_FILE % "18.0"
|
result = ADDONS_TEMPLATE_FILE % "18.0"
|
||||||
|
|
@ -123,9 +117,7 @@ class TestUpdateValidateVersion(unittest.TestCase):
|
||||||
self.assertEqual(update.new_version_odoo, "18.0")
|
self.assertEqual(update.new_version_odoo, "18.0")
|
||||||
self.assertEqual(update.new_version_python, "3.12.10")
|
self.assertEqual(update.new_version_python, "3.12.10")
|
||||||
self.assertEqual(update.new_version_poetry, "2.1.3")
|
self.assertEqual(update.new_version_poetry, "2.1.3")
|
||||||
self.assertEqual(
|
self.assertEqual(update.new_version_erplibre, "odoo18.0_python3.12.10")
|
||||||
update.new_version_erplibre, "odoo18.0_python3.12.10"
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_explicit_odoo_version(self):
|
def test_explicit_odoo_version(self):
|
||||||
data = {}
|
data = {}
|
||||||
|
|
@ -177,7 +169,9 @@ class TestUpdateValidateVersion(unittest.TestCase):
|
||||||
{"erplibre_version": "odoo18.0_python3.12.10"},
|
{"erplibre_version": "odoo18.0_python3.12.10"},
|
||||||
)
|
)
|
||||||
update.validate_version()
|
update.validate_version()
|
||||||
self.assertIn("default.dev.odoo18.0.xml", update.expected_manifest_name)
|
self.assertIn(
|
||||||
|
"default.dev.odoo18.0.xml", update.expected_manifest_name
|
||||||
|
)
|
||||||
self.assertIn("requirement", update.expected_pyproject_path)
|
self.assertIn("requirement", update.expected_pyproject_path)
|
||||||
self.assertIn("requirement", update.expected_poetry_lock_path)
|
self.assertIn("requirement", update.expected_poetry_lock_path)
|
||||||
self.assertEqual(update.expected_odoo_name, "odoo18.0")
|
self.assertEqual(update.expected_odoo_name, "odoo18.0")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue