Hello,
   Is there an easy of running .rst scenario files in python that we can 
see in the source code:
   For ex: 
https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l37

Currently, I am copying this .rst file , renaming to .py file, commenting 
out non-commands and deleting >>> markers to convert to a normal python 
file. Can this file be run directly in python instead?
For example I do the following :

#================ 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l1>#Invoice
 Scenario 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l2>#================
 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l3>
 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l4>#Imports::
 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l5>import
 datetime 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l6>from
 dateutil.relativedelta import relativedelta


from the original Few line of code from the top:


================ 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l1>Invoice
 Scenario 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l2>================
 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l3>
 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l4>Imports::
 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l5>
    >>> import datetime 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l6>
    >>> from dateutil.relativedelta import relativedelta 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l7>
    >>> from decimal import Decimal 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l8>
    >>> from operator import attrgetter 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l9>
    >>> from proteus import Model, Wizard 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l10>
    >>> from trytond.tests.tools import activate_modules 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l11>
    >>> from trytond.modules.company.tests.tools import create_company, \ 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l12>
    ...     get_company 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l13>
    >>> from trytond.modules.account.tests.tools import create_fiscalyear, \ 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l14>
    ...     create_chart, get_accounts, create_tax, set_tax_code 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l15>
    >>> from trytond.modules.account_invoice.tests.tools import \ 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l16>
    ...     set_fiscalyear_invoice_sequences 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l17>
    >>> today = datetime.date.today() 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l18>
 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l19>Install
 account_invoice:: 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l20>
 
<https://hg.tryton.org/modules/account_invoice/file/tip/tests/scenario_invoice.rst#l21>
    >>> config = activate_modules('account_invoice')

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/bae6782e-6a22-477f-ab1a-79656ffa1adc%40googlegroups.com.

Reply via email to