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.
-
Developer
@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
-
Owner
Thanks, that looks a good approach !
but what might be problematic is that we keep
bt5/erp5_invoicing/bt/skip_coding_style_test
, theseskip_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 witherp5_invoicing
there's nothing more to fix, so it would be better if we could find another way to disable coding style test forerp5_invoicing
that does not rely on thisskip_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
-
Owner
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, excepterp5_crm
,erp5_web
anderp5_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 theskip_coding_style_test
support. -
Owner
sure, go ahead !
PS: I said these business templates are "not really used" but in fact some of them are just not modified often
-
Developer
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.
-
Owner
oh yes probably :)