[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
|
||||
|
||||
from script.code_generator.search_class_model import (
|
||||
ARGS_TYPE_PARAM,
|
||||
extract_lambda,
|
||||
fill_search_field,
|
||||
search_and_replace,
|
||||
ARGS_TYPE_PARAM,
|
||||
)
|
||||
|
||||
|
||||
def count_space_tab(word, group_space=4):
|
||||
"""Copied from transform_python_to_code_writer (cannot import due to
|
||||
code_writer dependency not available in erplibre venv)."""
|
||||
|
|
@ -152,9 +154,7 @@ class TestFillSearchField(unittest.TestCase):
|
|||
class TestSearchAndReplace(unittest.TestCase):
|
||||
def test_replace_quoted_value(self):
|
||||
content = 'template_model_name = "old_model"'
|
||||
result = search_and_replace(
|
||||
content, "hooks.py", "new_model"
|
||||
)
|
||||
result = search_and_replace(content, "hooks.py", "new_model")
|
||||
self.assertIn('"new_model"', result)
|
||||
self.assertNotIn("old_model", result)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,26 +7,21 @@ import tempfile
|
|||
import unittest
|
||||
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):
|
||||
"""Test docker-compose.yml image version update."""
|
||||
|
||||
def _write_compose(self, content):
|
||||
f = tempfile.NamedTemporaryFile(
|
||||
mode="w", suffix=".yml", delete=False
|
||||
)
|
||||
f = tempfile.NamedTemporaryFile(mode="w", suffix=".yml", delete=False)
|
||||
f.write(content)
|
||||
f.close()
|
||||
return f.name
|
||||
|
||||
def test_updates_image_after_erplibre(self):
|
||||
path = self._write_compose(
|
||||
"services:\n"
|
||||
" ERPLibre:\n"
|
||||
" image: old:1.0\n"
|
||||
" ports:\n"
|
||||
"services:\n" " ERPLibre:\n" " image: old:1.0\n" " ports:\n"
|
||||
)
|
||||
config = SimpleNamespace(
|
||||
docker_compose_file=path,
|
||||
|
|
@ -64,17 +59,13 @@ class TestEditDockerProd(unittest.TestCase):
|
|||
"""Test Dockerfile.prod FROM line update."""
|
||||
|
||||
def _write_dockerfile(self, content):
|
||||
f = tempfile.NamedTemporaryFile(
|
||||
mode="w", suffix=".pkg", delete=False
|
||||
)
|
||||
f = tempfile.NamedTemporaryFile(mode="w", suffix=".pkg", delete=False)
|
||||
f.write(content)
|
||||
f.close()
|
||||
return f.name
|
||||
|
||||
def test_updates_from_line(self):
|
||||
path = self._write_dockerfile(
|
||||
"FROM base:old\nRUN apt-get update\n"
|
||||
)
|
||||
path = self._write_dockerfile("FROM base:old\nRUN apt-get update\n")
|
||||
config = SimpleNamespace(
|
||||
docker_compose_file="unused",
|
||||
docker_prod=path,
|
||||
|
|
|
|||
|
|
@ -34,9 +34,7 @@ class TestRemoveDotPath(unittest.TestCase):
|
|||
self.assertEqual(remove_dot_path("./"), "")
|
||||
|
||||
def test_nested_dot_slash(self):
|
||||
self.assertEqual(
|
||||
remove_dot_path("./a/./b"), "a/./b"
|
||||
)
|
||||
self.assertEqual(remove_dot_path("./a/./b"), "a/./b")
|
||||
|
||||
def test_empty_string(self):
|
||||
self.assertEqual(remove_dot_path(""), "")
|
||||
|
|
@ -75,15 +73,11 @@ class TestConstants(unittest.TestCase):
|
|||
|
||||
def test_pyproject_template(self):
|
||||
result = PYPROJECT_TEMPLATE_FILE % "odoo18.0_python3.12.10"
|
||||
self.assertEqual(
|
||||
result, "pyproject.odoo18.0_python3.12.10.toml"
|
||||
)
|
||||
self.assertEqual(result, "pyproject.odoo18.0_python3.12.10.toml")
|
||||
|
||||
def test_poetry_lock_template(self):
|
||||
result = POETRY_LOCK_TEMPLATE_FILE % "odoo18.0_python3.12.10"
|
||||
self.assertEqual(
|
||||
result, "poetry.odoo18.0_python3.12.10.lock"
|
||||
)
|
||||
self.assertEqual(result, "poetry.odoo18.0_python3.12.10.lock")
|
||||
|
||||
def test_addons_template(self):
|
||||
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_python, "3.12.10")
|
||||
self.assertEqual(update.new_version_poetry, "2.1.3")
|
||||
self.assertEqual(
|
||||
update.new_version_erplibre, "odoo18.0_python3.12.10"
|
||||
)
|
||||
self.assertEqual(update.new_version_erplibre, "odoo18.0_python3.12.10")
|
||||
|
||||
def test_explicit_odoo_version(self):
|
||||
data = {}
|
||||
|
|
@ -177,7 +169,9 @@ class TestUpdateValidateVersion(unittest.TestCase):
|
|||
{"erplibre_version": "odoo18.0_python3.12.10"},
|
||||
)
|
||||
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_poetry_lock_path)
|
||||
self.assertEqual(update.expected_odoo_name, "odoo18.0")
|
||||
|
|
|
|||
Loading…
Reference in a new issue