Skip to content

Commit

Permalink
[REM] tools: Remove the yml import engine
Browse files Browse the repository at this point in the history
  • Loading branch information
tivisse committed Nov 16, 2017
1 parent 83d5aee commit 77eb1f8
Show file tree
Hide file tree
Showing 14 changed files with 7 additions and 1,162 deletions.
1 change: 0 additions & 1 deletion addons/stock/tests/test_shipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
class TestInventory(TestStockCommon):

def test_shipment(self):
# TDE NOTE: this test replaces test/shipment.yml present until saas-10
# TDE TODO
# pickign.action_confirm -> confirm moves
# picking.do_prepare_partial, should create pack ops, write on it ?
Expand Down
4 changes: 0 additions & 4 deletions odoo/addons/test_impex/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,4 @@
'data': ['ir.model.access.csv'],
'installable': True,
'auto_install': False,
'test': [
'tests/test_import_reference.yml',
'tests/test_import_menuitem.yml',
]
}
67 changes: 0 additions & 67 deletions odoo/addons/test_impex/tests/test_import_menuitem.yml

This file was deleted.

44 changes: 0 additions & 44 deletions odoo/addons/test_impex/tests/test_import_reference.yml

This file was deleted.

2 changes: 1 addition & 1 deletion odoo/modules/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def _get_files_of_kind(kind):
files.append(f)
if k.endswith('_xml') and not (k == 'init_xml' and not f.endswith('.xml')):
# init_xml, update_xml and demo_xml are deprecated except
# for the case of init_xml with yaml, csv and sql files as
# for the case of init_xml with csv and sql files as
# we can't specify noupdate for those file.
correct_key = 'demo' if k.count('demo') else 'data'
_logger.warning(
Expand Down
14 changes: 1 addition & 13 deletions odoo/service/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -884,16 +884,6 @@ def _reexec(updated_modules=None):
args.insert(0, exe)
os.execv(sys.executable, args)

def load_test_file_yml(registry, test_file):
with registry.cursor() as cr:
odoo.tools.convert_yaml_import(cr, 'base', open(test_file, 'rb'), 'test', {}, 'init')
if config['test_commit']:
_logger.info('test %s has been commited', test_file)
cr.commit()
else:
_logger.info('test %s has been rollbacked', test_file)
cr.rollback()

def load_test_file_py(registry, test_file):
# Locate python module based on its filename and run the tests
test_path, _ = os.path.splitext(os.path.abspath(test_file))
Expand Down Expand Up @@ -928,9 +918,7 @@ def preload_registries(dbnames):
test_file = config['test_file']
_logger.info('loading test file %s', test_file)
with odoo.api.Environment.manage():
if test_file.endswith('yml'):
load_test_file_yml(registry, test_file)
elif test_file.endswith('py'):
if test_file.endswith('py'):
load_test_file_py(registry, test_file)

# run post-install tests
Expand Down
1 change: 0 additions & 1 deletion odoo/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from .translate import *
from .graph import graph
from .image import *
from .yaml_import import *
from .sql import *
from .float_utils import *
from .mail import *
Expand Down
2 changes: 1 addition & 1 deletion odoo/tools/assertion_report.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

class assertion_report(object):
"""
Simple pair of success and failures counts (used to record YAML and XML
Simple pair of success and failures counts (used to record XML
`assert` tags as well as unittest tests outcome (in this case, not
individual `assert`)).
"""
Expand Down
6 changes: 3 additions & 3 deletions odoo/tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ def __init__(self, fname=None):
# Testing Group
group = optparse.OptionGroup(parser, "Testing Configuration")
group.add_option("--test-file", dest="test_file", my_default=False,
help="Launch a python or YML test file.")
help="Launch a python test file.")
group.add_option("--test-report-directory", dest="test_report_directory", my_default=False,
help="If set, will save sample of all reports in this directory.")
group.add_option("--test-enable", action="store_true", dest="test_enable",
my_default=False, help="Enable YAML and unit tests.")
my_default=False, help="Enable unit tests.")
group.add_option("--test-commit", action="store_true", dest="test_commit",
my_default=False, help="Commit database changes performed by YAML or XML tests.")
my_default=False, help="Commit database changes performed by XML tests.")
parser.add_option_group(group)

# Logging Group
Expand Down
3 changes: 0 additions & 3 deletions odoo/tools/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from .config import config
from .misc import file_open, unquote, ustr, SKIPPED_ELEMENT_TYPES
from .translate import _
from .yaml_import import convert_yaml_import
from odoo import SUPERUSER_ID

_logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -786,8 +785,6 @@ def convert_file(cr, module, filename, idref, mode='update', noupdate=False, kin
convert_csv_import(cr, module, pathname, fp.read(), idref, mode, noupdate)
elif ext == '.sql':
convert_sql_import(cr, fp)
elif ext == '.yml':
convert_yaml_import(cr, module, fp, kind, idref, mode, noupdate, report)
elif ext == '.xml':
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
elif ext == '.js':
Expand Down
2 changes: 1 addition & 1 deletion odoo/tools/test_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
""" Helper functions for reports testing.
Please /do not/ import this file by default, but only explicitly call it
through the code of yaml tests.
through the code of python tests.
"""

import logging
Expand Down
Loading

0 comments on commit 77eb1f8

Please sign in to comment.