diff --git a/modules/account/tests/scenario_move_line_group.rst b/modules/account/tests/scenario_move_line_group.rst index 30af19ac51..f03eb9ebb1 100644 --- a/modules/account/tests/scenario_move_line_group.rst +++ b/modules/account/tests/scenario_move_line_group.rst @@ -149,7 +149,7 @@ Cancelling the delegation move:: ... cancel.execute('cancel') ... except CancelDelegatedWarning as warning: ... _, (key, *_) = warning.args - ... raise # doctest: +IGNORE_EXCEPTION_DETAIL + ... raise Traceback (most recent call last): ... CancelDelegatedWarning: ... diff --git a/modules/account_asset/tests/scenario_account_asset.rst b/modules/account_asset/tests/scenario_account_asset.rst index f4cf43c0c5..460670520d 100644 --- a/modules/account_asset/tests/scenario_account_asset.rst +++ b/modules/account_asset/tests/scenario_account_asset.rst @@ -145,7 +145,7 @@ Depreciate the asset:: Trying to close the period to check error:: >>> period = supplier_invoice.move.period - >>> period.click('close') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> period.click('close') Traceback (most recent call last): ... AccessError: ... @@ -180,7 +180,7 @@ Update the asset:: >>> update.form.next_depreciation_date == (supplier_invoice.invoice_date ... + relativedelta(months=4, days=-1)) True - >>> update.execute('create_move') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> update.execute('create_move') Traceback (most recent call last): ... ValueError: ... diff --git a/modules/account_budget/tests/scenario_account_budget.rst b/modules/account_budget/tests/scenario_account_budget.rst index 3799600e94..4bd91bcfc3 100644 --- a/modules/account_budget/tests/scenario_account_budget.rst +++ b/modules/account_budget/tests/scenario_account_budget.rst @@ -178,7 +178,7 @@ Try to set invalid ratio:: >>> period = pl_budget.periods[0] >>> period.ratio = Decimal('0.1') - >>> budget.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> budget.save() Traceback (most recent call last): ... BudgetValidationError: ... diff --git a/modules/account_deposit/tests/scenario_deposit.rst b/modules/account_deposit/tests/scenario_deposit.rst index f1a4e34932..cf66f24a87 100644 --- a/modules/account_deposit/tests/scenario_deposit.rst +++ b/modules/account_deposit/tests/scenario_deposit.rst @@ -96,7 +96,7 @@ Recall too much:: >>> deposit_line.unit_price = Decimal('-200.00') >>> deposit_line.save() - >>> invoice.click('post') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> invoice.click('post') Traceback (most recent call last): ... DepositError: ... diff --git a/modules/account_invoice/tests/scenario_cancelling_invoice_move.rst b/modules/account_invoice/tests/scenario_cancelling_invoice_move.rst index 67b3146dab..98645050db 100644 --- a/modules/account_invoice/tests/scenario_cancelling_invoice_move.rst +++ b/modules/account_invoice/tests/scenario_cancelling_invoice_move.rst @@ -83,7 +83,7 @@ Post invoice and cancel the created move:: 'posted' >>> cancel_move = Wizard('account.move.cancel', [invoice.move]) >>> cancel_move.form.description = 'Cancel' - >>> cancel_move.execute('cancel') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> cancel_move.execute('cancel') Traceback (most recent call last): ... CancelInvoiceMoveWarning: ... diff --git a/modules/account_invoice/tests/scenario_invoice_customer_sequential.rst b/modules/account_invoice/tests/scenario_invoice_customer_sequential.rst index cc360ff300..0f8814d89d 100644 --- a/modules/account_invoice/tests/scenario_invoice_customer_sequential.rst +++ b/modules/account_invoice/tests/scenario_invoice_customer_sequential.rst @@ -80,7 +80,7 @@ Try to post invoice on first period:: >>> line.account = accounts['revenue'] >>> invoice.save() - >>> invoice.click('post') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> invoice.click('post') Traceback (most recent call last): ... InvoiceNumberError: ... diff --git a/modules/account_invoice/tests/scenario_invoice_in_future.rst b/modules/account_invoice/tests/scenario_invoice_in_future.rst index 5a4367af05..2c5eab2756 100644 --- a/modules/account_invoice/tests/scenario_invoice_in_future.rst +++ b/modules/account_invoice/tests/scenario_invoice_in_future.rst @@ -58,7 +58,7 @@ Create invoice:: Posting an invoice in the future raises a warning:: >>> invoice.invoice_date = tomorrow - >>> invoice.click('post') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> invoice.click('post') Traceback (most recent call last): ... InvoiceFutureWarning: ... diff --git a/modules/account_invoice/tests/scenario_invoice_supplier.rst b/modules/account_invoice/tests/scenario_invoice_supplier.rst index e7bcac9d97..aadf34dbd8 100644 --- a/modules/account_invoice/tests/scenario_invoice_supplier.rst +++ b/modules/account_invoice/tests/scenario_invoice_supplier.rst @@ -205,7 +205,7 @@ A warning is raised when creating an invoice with same reference:: >>> line.product = product >>> line.quantity = 1 >>> line.unit_price = Decimal('20') - >>> invoice.click('post') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> invoice.click('post') Traceback (most recent call last): ... InvoiceSimilarWarning: ... diff --git a/modules/account_payment/tests/scenario_account_payment.rst b/modules/account_payment/tests/scenario_account_payment.rst index 857b843cb1..fa23cc8d0a 100644 --- a/modules/account_payment/tests/scenario_account_payment.rst +++ b/modules/account_payment/tests/scenario_account_payment.rst @@ -195,7 +195,7 @@ Try to pay blocked line:: >>> pay_line = Wizard('account.move.line.pay', [line]) >>> pay_line.execute('next_') - >>> pay_line.execute('next_') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> pay_line.execute('next_') Traceback (most recent call last): ... BlockedWarning: ... diff --git a/modules/account_payment/tests/scenario_account_payment_warnings.rst b/modules/account_payment/tests/scenario_account_payment_warnings.rst index ea810d22ce..04d794ce02 100644 --- a/modules/account_payment/tests/scenario_account_payment_warnings.rst +++ b/modules/account_payment/tests/scenario_account_payment_warnings.rst @@ -85,7 +85,7 @@ Pay line:: Try to cancel move:: >>> cancel_move = Wizard('account.move.cancel', [move]) - >>> cancel_move.execute('cancel') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> cancel_move.execute('cancel') Traceback (most recent call last): ... CancelWarning: ... @@ -94,7 +94,7 @@ Try to group lines:: >>> line2, = [l for l in move2.lines if l.account == accounts['payable']] >>> group_line = Wizard('account.move.line.group', [line, line2]) - >>> group_line.execute('group') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> group_line.execute('group') Traceback (most recent call last): ... GroupLineWarning: ... @@ -107,7 +107,7 @@ Try to reschedule line:: >>> reschedule_line.form.interval = 1 >>> reschedule_line.form.amount = Decimal('50.00') >>> reschedule_line.execute('preview') - >>> reschedule_line.execute('reschedule') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> reschedule_line.execute('reschedule') Traceback (most recent call last): ... RescheduleLineWarning: ... @@ -116,7 +116,7 @@ Try to delegate line:: >>> delegate_line = Wizard('account.move.line.delegate', [line]) >>> delegate_line.form.party = supplier2 - >>> delegate_line.execute('delegate') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> delegate_line.execute('delegate') Traceback (most recent call last): ... DelegateLineWarning: ... @@ -140,7 +140,7 @@ Reconcile line and try to submit:: >>> reconcile.state 'end' - >>> payment.click('submit') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> payment.click('submit') Traceback (most recent call last): ... ReconciledWarning: ... diff --git a/modules/account_statement/tests/scenario_account_statement.rst b/modules/account_statement/tests/scenario_account_statement.rst index b07dd78736..2996516dd2 100644 --- a/modules/account_statement/tests/scenario_account_statement.rst +++ b/modules/account_statement/tests/scenario_account_statement.rst @@ -211,7 +211,7 @@ Validate statement:: Try posting a move:: >>> statement_line = statement.lines[0] - >>> statement_line.move.click('post') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> statement_line.move.click('post') Traceback (most recent call last): ... trytond.modules.account.exceptions.PostError: ... @@ -360,7 +360,7 @@ Testing the use of an invoice in multiple statements:: >>> statement_line.related_to = customer_invoice4 >>> statement2.save() - >>> statement1.click('validate_statement') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> statement1.click('validate_statement') Traceback (most recent call last): ... StatementValidateWarning: ... @@ -396,7 +396,7 @@ Testing balance validation:: >>> line.amount = Decimal('60.00') >>> line.account = receivable >>> line.party = customer - >>> statement.click('validate_statement') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> statement.click('validate_statement') Traceback (most recent call last): ... StatementValidateError: ... @@ -425,7 +425,7 @@ Testing amount validation:: >>> line.amount = Decimal('50.00') >>> line.account = receivable >>> line.party = customer - >>> statement.click('validate_statement') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> statement.click('validate_statement') Traceback (most recent call last): ... StatementValidateError: ... @@ -454,7 +454,7 @@ Test number of lines validation:: >>> line.amount = Decimal('50.00') >>> line.account = receivable >>> line.party = customer - >>> statement.click('validate_statement') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> statement.click('validate_statement') Traceback (most recent call last): ... StatementValidateError: ... diff --git a/modules/account_statement/tests/scenario_statement_origin.rst b/modules/account_statement/tests/scenario_statement_origin.rst index b5f54335eb..890210cb0e 100644 --- a/modules/account_statement/tests/scenario_statement_origin.rst +++ b/modules/account_statement/tests/scenario_statement_origin.rst @@ -70,7 +70,7 @@ Create a statement with origins:: Statement can not be posted until all origins are finished:: - >>> statement.click('post') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> statement.click('post') Traceback (most recent call last): ... StatementPostError: ... diff --git a/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst b/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst index 66d2e295b5..356b42c0dc 100644 --- a/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst +++ b/modules/account_stock_shipment_cost/tests/scenario_account_stock_shipment_cost.rst @@ -203,7 +203,7 @@ Add a second shipment cost to 1 shipment:: ... post_shipment_cost.execute('post') ... except SamePartiesWarning as warning: ... _, (key, *_) = warning.args - ... raise # doctest: +IGNORE_EXCEPTION_DETAIL + ... raise Traceback (most recent call last): ... SamePartiesWarning: ... diff --git a/modules/account_tax_cash/tests/scenario_account_tax_cash_period_close.rst b/modules/account_tax_cash/tests/scenario_account_tax_cash_period_close.rst index fcfc509564..91edaa1c75 100644 --- a/modules/account_tax_cash/tests/scenario_account_tax_cash_period_close.rst +++ b/modules/account_tax_cash/tests/scenario_account_tax_cash_period_close.rst @@ -98,7 +98,7 @@ Receive cash:: Can not close the period:: - >>> period.click('close') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> period.click('close') Traceback (most recent call last): ... ClosePeriodWarning: ... diff --git a/modules/analytic_account/tests/scenario_analytic_account.rst b/modules/analytic_account/tests/scenario_analytic_account.rst index fc5b28cea0..136ed01651 100644 --- a/modules/analytic_account/tests/scenario_analytic_account.rst +++ b/modules/analytic_account/tests/scenario_analytic_account.rst @@ -220,7 +220,7 @@ Prevent changing root of account with entries:: >>> root2 = AnalyticAccount(type='root', name="Root2") >>> root2.save() >>> analytic_account.root = root2 - >>> analytic_account.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> analytic_account.save() Traceback (most recent call last): ... AccessError: ... @@ -234,7 +234,7 @@ Prevent changing root of account with entries:: Prevent changing type of analytic account with lines:: >>> analytic_account.type = 'view' - >>> analytic_account.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> analytic_account.save() Traceback (most recent call last): ... AccountValidationError: ... diff --git a/modules/attendance/tests/scenario_attendance.rst b/modules/attendance/tests/scenario_attendance.rst index a0af8c4927..e89e0090f6 100644 --- a/modules/attendance/tests/scenario_attendance.rst +++ b/modules/attendance/tests/scenario_attendance.rst @@ -76,7 +76,7 @@ You can't create attendances in closed periods:: >>> attendance.employee = employee >>> attendance.at = now >>> attendance.type = 'in' - >>> attendance.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> attendance.save() Traceback (most recent call last): ... PeriodClosedError: ... diff --git a/modules/incoterm/tests/scenario_incoterm.rst b/modules/incoterm/tests/scenario_incoterm.rst index aa0da2a643..4d07d33683 100644 --- a/modules/incoterm/tests/scenario_incoterm.rst +++ b/modules/incoterm/tests/scenario_incoterm.rst @@ -164,7 +164,7 @@ Try sale without incoterm:: >>> line.product = product >>> line.quantity = 1 >>> sale.incoterm = None - >>> sale.click('quote') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.click('quote') Traceback (most recent call last): ... SaleQuotationError: ... @@ -173,7 +173,7 @@ Try sale with incoterm:: >>> sale.incoterm, = Incoterm.find([ ... ('code', '=', 'CIF'), ('version', '=', '2020')]) - >>> sale.click('quote') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.click('quote') Traceback (most recent call last): ... RequiredValidationError: ... diff --git a/modules/party/tests/scenario_party_erase.rst b/modules/party/tests/scenario_party_erase.rst index 3ca063585a..51f6007913 100644 --- a/modules/party/tests/scenario_party_erase.rst +++ b/modules/party/tests/scenario_party_erase.rst @@ -35,7 +35,7 @@ Try erase active party:: >>> erase = Wizard('party.erase', models=[party]) >>> erase.form.party == party True - >>> erase.execute('erase') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> erase.execute('erase') Traceback (most recent call last): ... EraseError: ... diff --git a/modules/product/tests/scenario_product_identifier.rst b/modules/product/tests/scenario_product_identifier.rst index 53baf490da..11217e1c12 100644 --- a/modules/product/tests/scenario_product_identifier.rst +++ b/modules/product/tests/scenario_product_identifier.rst @@ -34,7 +34,7 @@ The identifier code is computed when set:: An Error is raised for invalid code:: - >>> product.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> product.save() Traceback (most recent call last): ... InvalidIdentifierCode: ... diff --git a/modules/product_cost_warehouse/tests/scenario_product_cost_warehouse.rst b/modules/product_cost_warehouse/tests/scenario_product_cost_warehouse.rst index 94bacea4c2..1731a18e4c 100644 --- a/modules/product_cost_warehouse/tests/scenario_product_cost_warehouse.rst +++ b/modules/product_cost_warehouse/tests/scenario_product_cost_warehouse.rst @@ -143,7 +143,7 @@ Forbid direct move between warehouses:: >>> move.unit_price = product.cost_price >>> move.currency = company.currency >>> move.save() - >>> move.click('do') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> move.click('do') Traceback (most recent call last): ... MoveValidationError: ... diff --git a/modules/production_outsourcing/tests/scenario_production_outsourcing.rst b/modules/production_outsourcing/tests/scenario_production_outsourcing.rst index f94ad5f1f5..fd41148887 100644 --- a/modules/production_outsourcing/tests/scenario_production_outsourcing.rst +++ b/modules/production_outsourcing/tests/scenario_production_outsourcing.rst @@ -151,7 +151,7 @@ Try to do the production with pending purchase:: >>> production.click('wait') >>> production.click('assign_force') >>> production.click('run') - >>> production.click('done') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> production.click('done') Traceback (most recent call last): ... PurchaseWarning: ... diff --git a/modules/project/tests/scenario_project_status.rst b/modules/project/tests/scenario_project_status.rst index cc09488f68..705fa363c7 100644 --- a/modules/project/tests/scenario_project_status.rst +++ b/modules/project/tests/scenario_project_status.rst @@ -51,7 +51,7 @@ Try to complete project without task:: >>> project.status = done >>> project.progress 1.0 - >>> project.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> project.save() Traceback (most recent call last): ... WorkProgressValidationError: ... @@ -64,7 +64,7 @@ Try to re-open task without project:: >>> task = Work(task.id) >>> task.progress = 0.5 - >>> task.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> task.save() Traceback (most recent call last): ... WorkProgressValidationError: ... @@ -72,7 +72,7 @@ Try to re-open task without project:: Change progress with updating status:: >>> project.progress = 0.8 - >>> project.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> project.save() Traceback (most recent call last): ... WorkProgressValidationError: ... diff --git a/modules/project_invoice/tests/scenario_project_invoice_effort.rst b/modules/project_invoice/tests/scenario_project_invoice_effort.rst index ddad0e454d..ef24221412 100644 --- a/modules/project_invoice/tests/scenario_project_invoice_effort.rst +++ b/modules/project_invoice/tests/scenario_project_invoice_effort.rst @@ -199,7 +199,7 @@ Try to change invoice line quantity:: >>> ProjectWork = Model.get('project.work') >>> task = ProjectWork(task.id) >>> task.invoice_line.quantity = 1 - >>> task.invoice_line.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> task.invoice_line.save() Traceback (most recent call last): ... InvoiceLineValidationError: ... diff --git a/modules/project_invoice/tests/scenario_project_invoice_progress.rst b/modules/project_invoice/tests/scenario_project_invoice_progress.rst index 019877a1d3..34d2fcb743 100644 --- a/modules/project_invoice/tests/scenario_project_invoice_progress.rst +++ b/modules/project_invoice/tests/scenario_project_invoice_progress.rst @@ -202,7 +202,7 @@ Try to change invoice line quantity:: >>> task = ProjectWork(task.id) >>> invoice_line = task.invoiced_progress[0].invoice_line >>> invoice_line.quantity = 2. - >>> invoice_line.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> invoice_line.save() Traceback (most recent call last): ... InvoiceLineValidationError: ... diff --git a/modules/project_invoice/tests/scenario_project_invoice_timesheet.rst b/modules/project_invoice/tests/scenario_project_invoice_timesheet.rst index 82557002be..a9d2518169 100644 --- a/modules/project_invoice/tests/scenario_project_invoice_timesheet.rst +++ b/modules/project_invoice/tests/scenario_project_invoice_timesheet.rst @@ -232,7 +232,7 @@ Try to change invoice line quantity:: >>> TimesheetLine = Model.get('timesheet.line') >>> line = TimesheetLine(line.id) >>> line.invoice_line.quantity = 5 - >>> line.invoice_line.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> line.invoice_line.save() Traceback (most recent call last): ... InvoiceLineValidationError: ... diff --git a/modules/purchase_blanket_agreement/tests/scenario_purchase_blanket_agreement.rst b/modules/purchase_blanket_agreement/tests/scenario_purchase_blanket_agreement.rst index 5a2567f347..28f159acaf 100644 --- a/modules/purchase_blanket_agreement/tests/scenario_purchase_blanket_agreement.rst +++ b/modules/purchase_blanket_agreement/tests/scenario_purchase_blanket_agreement.rst @@ -139,7 +139,7 @@ Try to change product with incompatible unit:: >>> blanket_agreement.click('draft') >>> line, = blanket_agreement.lines >>> line.product = product2 - >>> blanket_agreement.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> blanket_agreement.save() Traceback (most recent call last): ... UOMValidationError: ... @@ -149,7 +149,7 @@ Try to change product with incompatible unit:: Try to close blanket agreement with remaining quantity:: - >>> blanket_agreement.click('close') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> blanket_agreement.click('close') Traceback (most recent call last): ... BlanketAgreementClosingWarning: ... @@ -167,7 +167,7 @@ Try to purchase more than remaining:: >>> purchase_line.unit_price Decimal('7.0000') >>> purchase_line.quantity = 20 - >>> purchase.click('quote') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> purchase.click('quote') Traceback (most recent call last): ... BlanketAgreementQuantityWarning: ... diff --git a/modules/purchase_blanket_agreement/tests/test_scenario.py b/modules/purchase_blanket_agreement/tests/test_scenario.py index c80e682a7f..dc1d23e7e5 100644 --- a/modules/purchase_blanket_agreement/tests/test_scenario.py +++ b/modules/purchase_blanket_agreement/tests/test_scenario.py @@ -1,22 +1,8 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -import doctest -import glob -import os - -from trytond.tests.test_tryton import doctest_checker, doctest_teardown +from trytond.tests.test_tryton import load_doc_tests -def load_tests(loader, tests, pattern): - cwd = os.getcwd() - try: - os.chdir(os.path.dirname(__file__)) - for scenario in glob.glob('*.rst'): - tests.addTests(doctest.DocFileSuite( - scenario, tearDown=doctest_teardown, encoding='utf-8', - checker=doctest_checker, - optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)) - finally: - os.chdir(cwd) - return tests +def load_tests(*args, **kwargs): + return load_doc_tests(__name__, __file__, *args, **kwargs) diff --git a/modules/purchase_request/tests/scenario_purchase_request.rst b/modules/purchase_request/tests/scenario_purchase_request.rst index 54e264165e..bb26b438f3 100644 --- a/modules/purchase_request/tests/scenario_purchase_request.rst +++ b/modules/purchase_request/tests/scenario_purchase_request.rst @@ -279,7 +279,7 @@ Create the purchase without product:: It's not possible to delete a purchase linked to a purchase_request:: - >>> pr.purchase_line.purchase.delete() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> pr.purchase_line.purchase.delete() Traceback (most recent call last): ... AccessError: ... diff --git a/modules/purchase_requisition/tests/scenario_purchase_requisition.rst b/modules/purchase_requisition/tests/scenario_purchase_requisition.rst index 1b5b4fa2e5..f539eb0db8 100644 --- a/modules/purchase_requisition/tests/scenario_purchase_requisition.rst +++ b/modules/purchase_requisition/tests/scenario_purchase_requisition.rst @@ -134,7 +134,7 @@ Create purchase requisition without product and description:: >>> requisition_line.description = None >>> requisition_line.supplier = supplier >>> requisition_line.unit_price = Decimal('10') - >>> requisition.click('wait') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> requisition.click('wait') Traceback (most recent call last): ... RequiredValidationError: ... @@ -142,7 +142,7 @@ Create purchase requisition without product and description:: Create purchase requisition without product and quantity:: >>> requisition_line.description = 'Description' - >>> requisition.click('wait') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> requisition.click('wait') Traceback (most recent call last): ... RequiredValidationError: ... @@ -153,7 +153,7 @@ Create purchase requisition with product goods and without warehouse:: >>> requisition_line.product = product >>> requisition_line.description = 'Requisition Test' >>> requisition_line.quantity = 2.0 - >>> requisition.click('wait') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> requisition.click('wait') Traceback (most recent call last): ... RequiredValidationError: ... @@ -171,7 +171,7 @@ Approve workflow by requisition user raise an exception because he's not in approval_group:: >>> set_user(requisition_user) - >>> requisition.click('approve') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> requisition.click('approve') Traceback (most recent call last): ... AccessButtonError: ... @@ -180,7 +180,7 @@ Approve workflow by purchaser raise an exception because he's not in approval_group:: >>> set_user(purchase_user) - >>> requisition.click('approve') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> requisition.click('approve') Traceback (most recent call last): ... AccessButtonError: ... @@ -271,7 +271,7 @@ Confirm the purchase order:: Try to delete requisition done:: >>> set_user(requisition_user) - >>> PurchaseRequisition.delete([requisition]) # doctest: +IGNORE_EXCEPTION_DETAIL + >>> PurchaseRequisition.delete([requisition]) Traceback (most recent call last): ... AccessError: ... diff --git a/modules/quality/tests/scenario_quality_control_shipment.rst b/modules/quality/tests/scenario_quality_control_shipment.rst index 09d1255364..250e63b062 100644 --- a/modules/quality/tests/scenario_quality_control_shipment.rst +++ b/modules/quality/tests/scenario_quality_control_shipment.rst @@ -76,7 +76,7 @@ Receive product which fails quality inspection:: >>> inspection.state 'failed' - >>> shipment.click('receive') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment.click('receive') Traceback (most recent call last): ... InspectionError: ... diff --git a/modules/quality/tests/scenario_quality_inspection.rst b/modules/quality/tests/scenario_quality_inspection.rst index a7b675b8b1..6876fe2483 100644 --- a/modules/quality/tests/scenario_quality_inspection.rst +++ b/modules/quality/tests/scenario_quality_inspection.rst @@ -75,7 +75,7 @@ Create a partial inspection:: >>> inspection = Inspection() >>> inspection.control = control >>> inspection.points = {'boolean': True} - >>> inspection.click('process') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> inspection.click('process') Traceback (most recent call last): ... InspectionValidationError: ... diff --git a/modules/sale_advance_payment/tests/scenario_advance_payment.rst b/modules/sale_advance_payment/tests/scenario_advance_payment.rst index 19c4e6351a..99f5554177 100644 --- a/modules/sale_advance_payment/tests/scenario_advance_payment.rst +++ b/modules/sale_advance_payment/tests/scenario_advance_payment.rst @@ -248,7 +248,7 @@ Let's try to pack it:: >>> shipment.click('wait') >>> shipment.click('assign_try') >>> shipment.click('pick') - >>> shipment.click('pack') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment.click('pack') Traceback (most recent call last): ... ShippingBlocked: ... diff --git a/modules/sale_blanket_agreement/tests/scenario_sale_blanket_agreement.rst b/modules/sale_blanket_agreement/tests/scenario_sale_blanket_agreement.rst index 1ead146905..78ae69db20 100644 --- a/modules/sale_blanket_agreement/tests/scenario_sale_blanket_agreement.rst +++ b/modules/sale_blanket_agreement/tests/scenario_sale_blanket_agreement.rst @@ -135,7 +135,7 @@ Try to change product with incompatible unit:: >>> blanket_agreement.click('draft') >>> line, = blanket_agreement.lines >>> line.product = product2 - >>> blanket_agreement.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> blanket_agreement.save() Traceback (most recent call last): ... UOMValidationError: ... @@ -145,7 +145,7 @@ Try to change product with incompatible unit:: Try to close blanket agreement with remaining quantity:: - >>> blanket_agreement.click('close') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> blanket_agreement.click('close') Traceback (most recent call last): ... BlanketAgreementClosingWarning: ... @@ -164,7 +164,7 @@ Try to sale more than remaining:: >>> sale_line.unit_price Decimal('9.0000') >>> sale_line.quantity = 20 - >>> sale.click('quote') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.click('quote') Traceback (most recent call last): ... BlanketAgreementQuantityWarning: ... diff --git a/modules/sale_blanket_agreement/tests/test_scenario.py b/modules/sale_blanket_agreement/tests/test_scenario.py index c80e682a7f..dc1d23e7e5 100644 --- a/modules/sale_blanket_agreement/tests/test_scenario.py +++ b/modules/sale_blanket_agreement/tests/test_scenario.py @@ -1,22 +1,8 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. -import doctest -import glob -import os - -from trytond.tests.test_tryton import doctest_checker, doctest_teardown +from trytond.tests.test_tryton import load_doc_tests -def load_tests(loader, tests, pattern): - cwd = os.getcwd() - try: - os.chdir(os.path.dirname(__file__)) - for scenario in glob.glob('*.rst'): - tests.addTests(doctest.DocFileSuite( - scenario, tearDown=doctest_teardown, encoding='utf-8', - checker=doctest_checker, - optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)) - finally: - os.chdir(cwd) - return tests +def load_tests(*args, **kwargs): + return load_doc_tests(__name__, __file__, *args, **kwargs) diff --git a/modules/sale_gift_card/tests/scenario_sale_gift_card_goods.rst b/modules/sale_gift_card/tests/scenario_sale_gift_card_goods.rst index f4101fbf69..b7dad3b834 100644 --- a/modules/sale_gift_card/tests/scenario_sale_gift_card_goods.rst +++ b/modules/sale_gift_card/tests/scenario_sale_gift_card_goods.rst @@ -118,7 +118,7 @@ Ship the gift card:: >>> shipment.click('assign_force') >>> shipment.click('pick') >>> shipment.click('pack') - >>> shipment.click('done') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment.click('done') Traceback (most recent call last): ... MoveGiftCardValidationError: ... diff --git a/modules/sale_payment/tests/scenario_sale_payment.rst b/modules/sale_payment/tests/scenario_sale_payment.rst index c9eff83f42..ff99c13b86 100644 --- a/modules/sale_payment/tests/scenario_sale_payment.rst +++ b/modules/sale_payment/tests/scenario_sale_payment.rst @@ -99,7 +99,7 @@ Create a partial payment:: Attempt to put sale back to draft:: - >>> sale.click('draft') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.click('draft') Traceback (most recent call last): ... AccessError: ... @@ -108,7 +108,7 @@ Attempt to put sale back to draft:: Attempt to cancel sale:: - >>> sale.click('cancel') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.click('cancel') Traceback (most recent call last): ... AccessError: ... @@ -133,7 +133,7 @@ Attempt to add a second payment to draft sale:: >>> payment.party = sale.party >>> payment.origin = sale >>> payment.amount = Decimal('30.00') - >>> payment.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> payment.save() Traceback (most recent call last): ... DomainValidationError: ... @@ -152,7 +152,7 @@ Attempt to add a second payment to the cancelled sale:: >>> payment.party = sale.party >>> payment.origin = sale >>> payment.amount = Decimal('30.00') - >>> payment.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> payment.save() Traceback (most recent call last): ... DomainValidationError: ... diff --git a/modules/sale_point/tests/scenario_sale_point_session.rst b/modules/sale_point/tests/scenario_sale_point_session.rst index c74da616b9..f9ca21b8a6 100644 --- a/modules/sale_point/tests/scenario_sale_point_session.rst +++ b/modules/sale_point/tests/scenario_sale_point_session.rst @@ -169,7 +169,7 @@ Check the new session:: Try to close:: - >>> session.click('close') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> session.click('close') Traceback (most recent call last): ... SessionValidationError: ... diff --git a/modules/sale_product_quantity/tests/scenario_sale_product_quantity.rst b/modules/sale_product_quantity/tests/scenario_sale_product_quantity.rst index 27147b86b8..61ea3ab438 100644 --- a/modules/sale_product_quantity/tests/scenario_sale_product_quantity.rst +++ b/modules/sale_product_quantity/tests/scenario_sale_product_quantity.rst @@ -61,7 +61,7 @@ Can not set quantity below minimal:: >>> line, = sale.lines >>> line.quantity = 0.05 - >>> sale.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.save() Traceback (most recent call last): ... SaleValidationError: ... @@ -70,7 +70,7 @@ Can not set quantity different than rounding:: >>> line, = sale.lines >>> line.quantity = 1.01 - >>> sale.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.save() Traceback (most recent call last): ... SaleValidationError: ... @@ -86,7 +86,7 @@ Can not set quantity below minimal:: >>> line, = sale.lines >>> line.quantity = 50 - >>> sale.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.save() Traceback (most recent call last): ... SaleValidationError: ... @@ -95,7 +95,7 @@ Can not set quantity different than rounding:: >>> line, = sale.lines >>> line.quantity = 505 - >>> sale.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.save() Traceback (most recent call last): ... SaleValidationError: ... diff --git a/modules/sale_product_quantity/tests/scenario_sale_product_quantity_pos.rst b/modules/sale_product_quantity/tests/scenario_sale_product_quantity_pos.rst index 70326d4c48..717a93cfaa 100644 --- a/modules/sale_product_quantity/tests/scenario_sale_product_quantity_pos.rst +++ b/modules/sale_product_quantity/tests/scenario_sale_product_quantity_pos.rst @@ -83,7 +83,7 @@ Can not set quantity below minimal:: >>> line, = sale.lines >>> line.quantity = 0.05 - >>> sale.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.save() Traceback (most recent call last): ... SaleValidationError: ... @@ -92,7 +92,7 @@ Can not set quantity different than rounding:: >>> line, = sale.lines >>> line.quantity = 1.01 - >>> sale.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.save() Traceback (most recent call last): ... SaleValidationError: ... diff --git a/modules/sale_shipment_tolerance/tests/scenario_sale_over_shipment_tolerance.rst b/modules/sale_shipment_tolerance/tests/scenario_sale_over_shipment_tolerance.rst index 8a04ccee1e..583786489f 100644 --- a/modules/sale_shipment_tolerance/tests/scenario_sale_over_shipment_tolerance.rst +++ b/modules/sale_shipment_tolerance/tests/scenario_sale_over_shipment_tolerance.rst @@ -84,7 +84,7 @@ Prevent over ship 13 products:: >>> shipment.click('wait') >>> shipment.click('assign_force') >>> shipment.click('pick') - >>> shipment.click('pack') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment.click('pack') Traceback (most recent call last): ... OverShipmentWarning: ... diff --git a/modules/sale_stock_quantity/tests/scenario_sale_stock_quantity.rst b/modules/sale_stock_quantity/tests/scenario_sale_stock_quantity.rst index b70434de37..c8452cdd53 100644 --- a/modules/sale_stock_quantity/tests/scenario_sale_stock_quantity.rst +++ b/modules/sale_stock_quantity/tests/scenario_sale_stock_quantity.rst @@ -138,7 +138,7 @@ Sale 2 more products with not enough stock:: >>> sale_line.quantity = 2.0 >>> len(sale_line.notifications()) 0 - >>> sale.click('quote') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.click('quote') Traceback (most recent call last): ... StockQuantityWarning: ... @@ -157,7 +157,7 @@ Sale 6 products with not enough stock:: >>> sale_line.quantity = 6.0 >>> len(sale_line.notifications()) 1 - >>> sale.click('quote') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.click('quote') Traceback (most recent call last): ... StockQuantityWarning: ... @@ -187,7 +187,7 @@ Sale 4 products with not enough forecast:: >>> sale_line = sale.lines.new() >>> sale_line.product = product >>> sale_line.quantity = 4.0 - >>> sale.click('quote') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> sale.click('quote') Traceback (most recent call last): ... StockQuantityWarning: ... diff --git a/modules/sale_subscription_asset/tests/scenario_sale_subscription_asset.rst b/modules/sale_subscription_asset/tests/scenario_sale_subscription_asset.rst index b3559d031a..1ecc8a8f7e 100644 --- a/modules/sale_subscription_asset/tests/scenario_sale_subscription_asset.rst +++ b/modules/sale_subscription_asset/tests/scenario_sale_subscription_asset.rst @@ -100,7 +100,7 @@ Subscribe:: >>> line.quantity = 1 >>> subscription.click('quote') - >>> subscription.click('run') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> subscription.click('run') Traceback (most recent call last): ... RequiredValidationError: ... @@ -134,7 +134,7 @@ Creating an overlapping line won't work:: >>> line.start_date = datetime.date(2017, 1, 1) >>> line.quantity = 1 >>> line.asset_lot = lot1 - >>> overlapping.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> overlapping.save() Traceback (most recent call last): ... ValidationError: .... diff --git a/modules/stock/tests/scenario_stock_inventory_count.rst b/modules/stock/tests/scenario_stock_inventory_count.rst index c362f54431..7bb2e6bae2 100644 --- a/modules/stock/tests/scenario_stock_inventory_count.rst +++ b/modules/stock/tests/scenario_stock_inventory_count.rst @@ -69,7 +69,7 @@ Count inventory:: >>> count.form.search = product - >>> count.execute('quantity') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> count.execute('quantity') Traceback (most recent call last): ... InventoryCountWarning: ... diff --git a/modules/stock/tests/scenario_stock_move_in_future.rst b/modules/stock/tests/scenario_stock_move_in_future.rst index 3bdfbe5aad..b69bc63651 100644 --- a/modules/stock/tests/scenario_stock_move_in_future.rst +++ b/modules/stock/tests/scenario_stock_move_in_future.rst @@ -58,7 +58,7 @@ A warning is raised when doing a move in the future:: >>> move.quantity = 2 >>> move.unit_price = Decimal('1') >>> move.save() - >>> move.click('do') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> move.click('do') Traceback (most recent call last): ... MoveFutureWarning: ... diff --git a/modules/stock/tests/scenario_stock_shipment_in.rst b/modules/stock/tests/scenario_stock_shipment_in.rst index bbb5835b9d..1e6ad79544 100644 --- a/modules/stock/tests/scenario_stock_shipment_in.rst +++ b/modules/stock/tests/scenario_stock_shipment_in.rst @@ -86,7 +86,7 @@ Change inventory quantity and try to finish:: >>> inventory_move, = shipment.inventory_moves >>> inventory_move.quantity = 11 - >>> shipment.click('done') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment.click('done') Traceback (most recent call last): ... ShipmentCheckQuantityWarning: ... @@ -103,7 +103,7 @@ Add extra product to inventory and try to finish:: >>> move.quantity = 1 >>> move.from_location = input_loc >>> move.to_location = storage_loc - >>> shipment.click('done') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment.click('done') Traceback (most recent call last): ... ShipmentCheckQuantityWarning: ... diff --git a/modules/stock_location_move/tests/scenario_stock_location_move.rst b/modules/stock_location_move/tests/scenario_stock_location_move.rst index 942d11ebd3..7930d39d7f 100644 --- a/modules/stock_location_move/tests/scenario_stock_location_move.rst +++ b/modules/stock_location_move/tests/scenario_stock_location_move.rst @@ -66,7 +66,7 @@ Assign pallet from wrong location:: >>> shipment.to_location = storage2 >>> shipment.locations.append(Location(pallet.id)) >>> shipment.click('wait') - >>> shipment.click('assign_try') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment.click('assign_try') Traceback (most recent call last): ... DomainValidationError: ... @@ -88,7 +88,7 @@ Concurrently move pallet:: >>> shipment1.click('assign_try') >>> shipment1.state 'assigned' - >>> shipment2.click('assign_try') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment2.click('assign_try') Traceback (most recent call last): ... AssignError: ... diff --git a/modules/stock_lot/tests/scenario_stock_lot_shipment_in.rst b/modules/stock_lot/tests/scenario_stock_lot_shipment_in.rst index 160d6d7434..e2397a5141 100644 --- a/modules/stock_lot/tests/scenario_stock_lot_shipment_in.rst +++ b/modules/stock_lot/tests/scenario_stock_lot_shipment_in.rst @@ -82,7 +82,7 @@ Change lot and try to finish:: >>> incoming_move.lot == lot1 True >>> incoming_move.lot = lot2 - >>> shipment.click('done') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment.click('done') Traceback (most recent call last): ... ShipmentCheckQuantityWarning: ... diff --git a/modules/stock_lot/tests/scenario_stock_lot_shipment_out.rst b/modules/stock_lot/tests/scenario_stock_lot_shipment_out.rst index e8997d6ec2..0a3154925f 100644 --- a/modules/stock_lot/tests/scenario_stock_lot_shipment_out.rst +++ b/modules/stock_lot/tests/scenario_stock_lot_shipment_out.rst @@ -104,7 +104,7 @@ Check the inventory moves origin:: Try to pick without lot:: - >>> shipment_out.click('pick') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment_out.click('pick') Traceback (most recent call last): ... RequiredValidationError: ... diff --git a/modules/stock_lot_unit/tests/scenario_stock_lot_unit.rst b/modules/stock_lot_unit/tests/scenario_stock_lot_unit.rst index 582fb0ee62..0a83e3c418 100644 --- a/modules/stock_lot_unit/tests/scenario_stock_lot_unit.rst +++ b/modules/stock_lot_unit/tests/scenario_stock_lot_unit.rst @@ -132,7 +132,7 @@ Let's ship now two times the same lot:: >>> move1.lot = lot >>> move2.lot = lot >>> shipment.save() - >>> shipment.click('pick') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment.click('pick') Traceback (most recent call last): ... LotUnitQuantityError: ... @@ -156,7 +156,7 @@ Now let's ship one move with a quantity bigger than lot unit quantity:: >>> shipment.click('assign_try') >>> move, = shipment.inventory_moves >>> move.lot = lot - >>> shipment.click('pick') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment.click('pick') Traceback (most recent call last): ... LotUnitQuantityError: ... @@ -175,7 +175,7 @@ Make an inventory:: >>> line.lot = lot >>> line.quantity = 3 >>> inventory.save() - >>> inventory.click('confirm') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> inventory.click('confirm') Traceback (most recent call last): ... LotUnitQuantityError: ... diff --git a/modules/stock_package/tests/scenario_stock_package.rst b/modules/stock_package/tests/scenario_stock_package.rst index 460c51048a..6843a42fd0 100644 --- a/modules/stock_package/tests/scenario_stock_package.rst +++ b/modules/stock_package/tests/scenario_stock_package.rst @@ -107,7 +107,7 @@ Package products:: 2 >>> package_child.moves.append(moves[0]) - >>> shipment_out.save() # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment_out.save() Traceback (most recent call last): ... PackageValidationError: ... @@ -116,7 +116,7 @@ Package products:: >>> package1.packaging_volume 0.96 - >>> shipment_out.click('pack') # doctest: +IGNORE_EXCEPTION_DETAIL + >>> shipment_out.click('pack') Traceback (most recent call last): ... PackageError: ... diff --git a/modules/stock_quantity_issue/tests/scenario_stock_quantity_issue.rst b/modules/stock_quantity_issue/tests/scenario_stock_quantity_issue.rst index 647f15fa49..e819f6a333 100644 --- a/modules/stock_quantity_issue/tests/scenario_stock_quantity_issue.rst +++ b/modules/stock_quantity_issue/tests/scenario_stock_quantity_issue.rst @@ -129,7 +129,7 @@ Check quantity issues:: Apply best planned date to first shipment:: >>> issue1.click('process') - >>> issue1.click('solve') #doctest: +IGNORE_EXCEPTION_DETAIL + >>> issue1.click('solve') Traceback (most recent call last): ... QuantityIssueError: ... diff --git a/trytond/CHANGELOG b/trytond/CHANGELOG index b009e8de89..70aa9aca8e 100644 --- a/trytond/CHANGELOG +++ b/trytond/CHANGELOG @@ -1,3 +1,4 @@ +* Set IGNORE_EXCEPTION_DETAIL option flag on doctest * Add timeout parameter on RPC definitions Version 7.0.0 - 2023-10-30 diff --git a/trytond/trytond/tests/test_tryton.py b/trytond/trytond/tests/test_tryton.py index b8dc2d9a99..32ff5d8d63 100644 --- a/trytond/trytond/tests/test_tryton.py +++ b/trytond/trytond/tests/test_tryton.py @@ -1125,7 +1125,8 @@ def load_doc_tests(name, path, loader, tests, pattern): scenario, package=name, globs=globs, tearDown=doctest_teardown, encoding='utf-8', checker=doctest_checker, - optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)) + optionflags=doctest.REPORT_ONLY_FIRST_FAILURE + | doctest.IGNORE_EXCEPTION_DETAIL)) finally: os.chdir(cwd) return tests