doc/book/en/tutorials/advanced/index.rst
branchstable
changeset 5432 ee246e1813c6
parent 5350 49c065ae225e
child 5608 f9ab62103ad4
equal deleted inserted replaced
5429:5ca1f8fe8a42 5432:ee246e1813c6
   506 	unittest_main()
   506 	unittest_main()
   507 
   507 
   508 It's not complete, but show most things you'll want to do in tests: adding some
   508 It's not complete, but show most things you'll want to do in tests: adding some
   509 content, creating users and connecting as them in the test, etc...
   509 content, creating users and connecting as them in the test, etc...
   510 
   510 
   511 To run it type: ::
   511 To run it type:
   512 
   512 
   513     [syt@scorpius test]$ pytest unittest_sytweb.py
   513 .. sourcecode:: bash
       
   514 
       
   515     $ pytest unittest_sytweb.py
   514     ========================  unittest_sytweb.py  ========================
   516     ========================  unittest_sytweb.py  ========================
   515     -> creating tables [....................]
   517     -> creating tables [....................]
   516     -> inserting default user and default groups.
   518     -> inserting default user and default groups.
   517     -> storing the schema in the database [....................]
   519     -> storing the schema in the database [....................]
   518     -> database for instance data initialized.
   520     -> database for instance data initialized.
   522 
   524 
   523     OK
   525     OK
   524 
   526 
   525 
   527 
   526 The first execution is taking time, since it creates a sqlite database for the
   528 The first execution is taking time, since it creates a sqlite database for the
   527 test instance. The second one will be much quicker: ::
   529 test instance. The second one will be much quicker:
   528 
   530 
   529     [syt@scorpius test]$ pytest unittest_sytweb.py
   531 .. sourcecode:: bash
       
   532     
       
   533     $ pytest unittest_sytweb.py
   530     ========================  unittest_sytweb.py  ========================
   534     ========================  unittest_sytweb.py  ========================
   531     .
   535     .
   532     ----------------------------------------------------------------------
   536     ----------------------------------------------------------------------
   533     Ran 1 test in 2.662s
   537     Ran 1 test in 2.662s
   534 
   538 
   535     OK
   539     OK
   536 
   540 
   537 If you do some changes in your schema, you'll have to force regeneration of that
   541 If you do some changes in your schema, you'll have to force regeneration of that
   538 database. You do that by removing the tmpdb files before running the test: ::
   542 database. You do that by removing the tmpdb files before running the test: ::
   539 
   543 
   540     [syt@scorpius test]$ rm tmpdb*
   544     $ rm tmpdb*
   541 
   545 
   542 
   546 
   543 .. Note::
   547 .. Note::
   544   pytest is a very convenient utilities to control test execution, from the `logilab-common`_
   548   pytest is a very convenient utility used to control test execution. It is available from the `logilab-common`_ package.
   545   package
       
   546 
   549 
   547 .. _`logilab-common`: http://www.logilab.org/project/logilab-common
   550 .. _`logilab-common`: http://www.logilab.org/project/logilab-common
   548 
   551 
   549 .. _adv_tuto_migration_script:
   552 .. _adv_tuto_migration_script:
   550 
   553 
   576 * update schema's permissions definition (the later instruction)
   579 * update schema's permissions definition (the later instruction)
   577 
   580 
   578 
   581 
   579 To migrate my instance I simply type::
   582 To migrate my instance I simply type::
   580 
   583 
   581    [syt@scorpius ~]$ cubicweb-ctl upgrade sytweb
   584    cubicweb-ctl upgrade sytweb
   582 
   585 
   583 I'll then be asked some questions to do the migration step by step. You should say
   586 I'll then be asked some questions to do the migration step by step. You should say
   584 YES when it asks if a backup of your database should be done, so you can get back
   587 YES when it asks if a backup of your database should be done, so you can get back
   585 to initial state if anything goes wrong...
   588 to initial state if anything goes wrong...
   586 
   589