Commit ded3ba87 authored by Arnaud Fontaine's avatar Arnaud Fontaine

CodingStyleTest: Prepare migration of Invoicing Unit Tests to ZODB Components.

efd71291 added on erp5_invoicing a test dependency on erp5_advanced_invoicing.
However, testRule for example uses erp5_invoicing but not erp5_advanced_invoicing
so this would not work.

Moreover, erp5_{simplified,advanced}_invoicing enhance erp5_invoicing by providing
a container for Invoice Line so to match real world use cases it is better to
have two CodingStyle tests: one checking erp5_invoicing+erp5_simplified_invoicing
and the other one erp5_invoicing+erp5_advanced_invoicing.

Also, fix CodingStyle issues on erp5_advanced_invoicing.
parent 75309541
"""This script is called on the Invoice after the delivery builder has created """This script is called on the Invoice after the delivery builder has created
the new Invoice. the new Invoice.
""" """
from Products.ERP5Type.Message import translateString
if related_simulation_movement_path_list is None: if related_simulation_movement_path_list is None:
raise RuntimeError, 'related_simulation_movement_path_list is missing. Update ERP5 Product.' raise RuntimeError, 'related_simulation_movement_path_list is missing. Update ERP5 Product.'
......
erp5_advanced_invoicing
\ No newline at end of file
...@@ -180,6 +180,9 @@ ignored_skin_id_set = { ...@@ -180,6 +180,9 @@ ignored_skin_id_set = {
'PdmZuite_reset', 'PdmZuite_reset',
'PdmZuite_CommonTemplateForRenderjsUi', 'PdmZuite_CommonTemplateForRenderjsUi',
'PdmZuite_checkStockBrowserForRenderjsUi', 'PdmZuite_checkStockBrowserForRenderjsUi',
'AdvancedInvoiceTransaction_postTransactionLineGeneration',
'InvoiceTransaction_jumpToOrder',
'InvoiceTransaction_jumpToPackingList',
} }
# Generic method to check consistency of a skin item # Generic method to check consistency of a skin item
......
...@@ -99,10 +99,17 @@ def test_suite(): ...@@ -99,10 +99,17 @@ def test_suite():
}, },
) )
tested_business_template_list = [tested_business_template]
# erp5_invoicing doesn't define a container for Invoice Line: defined in
# erp5_simplified_invoicing (SIT/PIT) and erp5_advanced_invoicing (SI/PI)
if tested_business_template in ('erp5_simplified_invoicing',
'erp5_advanced_invoicing'):
tested_business_template_list.append('erp5_invoicing')
testXHTML.addTestMethodDynamically( testXHTML.addTestMethodDynamically(
testclass, testclass,
testXHTML.validator, testXHTML.validator,
(tested_business_template,), tested_business_template_list,
expected_failure_list=( expected_failure_list=(
# this view needs VCS preference set (this test suite does not support # this view needs VCS preference set (this test suite does not support
# setting preferences, but this might be a way to fix this). # setting preferences, but this might be a way to fix this).
......
  • @jerome Both pass and below is runUnitTest output. What do you think?

    erp5_simplified_invoicing

    Running Unit tests of <class 'CodingStyleTest.CodingStyleTest erp5_simplified_invoicing'> ok test_PythonSourceCode (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) test python script from the tested business templates. ... ok test_SkinCodingStyle (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_SkinItemId (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_SkinsTool_checkFieldExternalValidator (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_callableCountMethodInListbox (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_callableListMethodInListbox (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_configurationOfFieldLibrary (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_deadProxyFields (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_duplicatingSelectionNameInListbox (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_emptySelectionNameInListbox (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_invoicing_Invoice_Line_DeliveryLine_viewAggregatedAmountList (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_invoicing_Invoice_Line_InvoiceLine_view (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_invoicing_Invoice_Line_InvoiceLine_viewPrice (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_invoicing_Invoice_Line_InvoiceLine_viewQuantity (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_invoicing_Invoice_Root_Simulation_Rule_Rule_view (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_invoicing_Invoice_Simulation_Rule_Rule_view (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_invoicing_Invoice_Transaction_Simulation_Rule_Rule_view (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_invoicing_Trade_Model_Simulation_Rule_Rule_view (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_simplified_invoicing_Purchase_Invoice_Transaction_Delivery_viewAggregatedAmountList (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_simplified_invoicing_Purchase_Invoice_Transaction_PurchaseInvoiceTransaction_viewInvoice (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_simplified_invoicing_Purchase_Invoice_Transaction_TradeCondition_viewPayment (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_simplified_invoicing_Sale_Invoice_Transaction_Delivery_viewAggregatedAmountList (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_simplified_invoicing_Sale_Invoice_Transaction_SaleInvoiceTransaction_viewInvoice (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_erp5_simplified_invoicing_Sale_Invoice_Transaction_TradeCondition_viewPayment (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_html_file (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_listActionInListbox (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_moduleListMethod (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) Make sure that module's list method works. ... ok test_portalTypesDomainTranslation (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok test_preferenceViewDuplication (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) Make sure that preference view is not duplicated. ... ok test_rebuild_business_template (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) Try to rebuild business template to catch packaging errors. ... ok test_run_upgrader (CodingStyleTest.CodingStyleTest erp5_simplified_invoicing) ... ok

    erp5_advanced_invoicing

    Running Unit tests of <class 'CodingStyleTest.CodingStyleTest erp5_advanced_invoicing'> ok test_PythonSourceCode (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) test python script from the tested business templates. ... ok test_SkinCodingStyle (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_SkinItemId (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_SkinsTool_checkFieldExternalValidator (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_callableCountMethodInListbox (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_callableListMethodInListbox (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_configurationOfFieldLibrary (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_deadProxyFields (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_duplicatingSelectionNameInListbox (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_emptySelectionNameInListbox (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_advanced_invoicing_Purchase_Invoice_Base_viewDocumentList (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_advanced_invoicing_Purchase_Invoice_Module_PurchaseInvoiceModule_viewPurchaseInvoiceList (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_advanced_invoicing_Purchase_Invoice_PurchaseInvoice_viewInvoice (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_advanced_invoicing_Purchase_Invoice_PurchaseTradeCondition_viewProfile (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_advanced_invoicing_Purchase_Invoice_TradeCondition_viewPayment (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_advanced_invoicing_Sale_Invoice_Module_SaleInvoiceModule_viewSaleInvoiceList (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_advanced_invoicing_Sale_Invoice_SaleInvoice_viewInvoice (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_advanced_invoicing_Sale_Invoice_TradeCondition_viewPayment (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_invoicing_Invoice_Line_DeliveryLine_viewAggregatedAmountList (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_invoicing_Invoice_Line_InvoiceLine_view (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_invoicing_Invoice_Line_InvoiceLine_viewPrice (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_invoicing_Invoice_Line_InvoiceLine_viewQuantity (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_invoicing_Invoice_Root_Simulation_Rule_Rule_view (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_invoicing_Invoice_Simulation_Rule_Rule_view (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_invoicing_Invoice_Transaction_Simulation_Rule_Rule_view (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_erp5_invoicing_Trade_Model_Simulation_Rule_Rule_view (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_html_file (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_listActionInListbox (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_moduleListMethod (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) Make sure that module's list method works. ... ok test_portalTypesDomainTranslation (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok test_preferenceViewDuplication (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) Make sure that preference view is not duplicated. ... ok test_rebuild_business_template (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) Try to rebuild business template to catch packaging errors. ... ok test_run_upgrader (CodingStyleTest.CodingStyleTest erp5_advanced_invoicing) ... ok

  • Thanks, that looks a good approach !

    but what might be problematic is that we keep bt5/erp5_invoicing/bt/skip_coding_style_test, these skip_coding_style_test was kind of a hack, they are not exported by business template, with the idea that when we export a business template that was not yet cleaned up to run coding style test we have this file removed that we should either not commit or we should make business template pass coding style - so it's really something for the transition. The concern is just that here with erp5_invoicing there's nothing more to fix, so it would be better if we could find another way to disable coding style test for erp5_invoicing that does not rely on this skip_coding_style_test temporary solution ... can we do something like this for example ?

    def test_suite():
      suite = unittest.TestSuite()
      tested_business_template = os.environ['TESTED_BUSINESS_TEMPLATE']
      if tested_business_template == 'erp5_invoicing':
        return suite # or maybe return None ? I have not tried
  • @jerome I see. I didn't know about that. I thought it was now a property of Business Template. But this is a bit annoying because when we commit bt5, we always have to explicitly prevent skip_coding_style_test from being deleted. Not sure but shouldn't it be made permanent?

  • The idea is that all the skip_coding_style_test is temporary and that instead of spending time implementing something better we spend time fixing the coding style messages so we can enable the tests.

    I see we still have 109 business templates (out of a total of 336) with skip_coding_style_test, but most of them are not really used, except erp5_crm, erp5_web and erp5_core_test (I guess this one has lots of pylint warnings in tests). When I have time I try to enable coding style on more bt. Then one day we can remove all the skip_coding_style_test support.

  • @jerome I see, thanks. I will do what you suggested before and then merge if that's ok with you.

    but most of them are not really used, except erp5_crm, erp5_web and erp5_core_test

    Maybe it's a good opportunity to move some of them to erp5-archive.git ;-).

  • sure, go ahead !

    PS: I said these business templates are "not really used" but in fact some of them are just not modified often

  • Yes, this is what I understood. I just meant that among these 109 bt, I'm sure some of them are not maintained/used anymore and it would be a good idea to move them to erp5-archive.

    Edited by Arnaud Fontaine
  • oh yes probably :)

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment