bugGNU Health - Bugs: bug #61850, Issues with package testing

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #61850: Issues with package testing

Submitter:  Axel Braun <coogor>
Submitted:  Tue 18 Jan 2022 08:08:52 PM UTC
 
Category:  Tryton Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  meanmicio
Open/Closed:  Open Release:  3.9.0
Module:  * helath
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       No canned response available

 

Wed 19 Jan 2022 02:30:26 PM UTC, comment #2: 

Yes, testing can become quite tricky, as the setup is not 'simple', see below. In any case it should be optional.

I think in the trytond-testsuite there is a workaround for the below issue:

 [    6s] ==================================== ERRORS ====================================
[    6s] __________________ ERROR collecting tests/test_health.py ___________________
[    6s] tests/test_health.py:2: in <module>
[    6s]     import trytond.tests.test_tryton
[    6s] <frozen importlib._bootstrap>:971: in _find_and_load
[    6s]     ???
[    6s] <frozen importlib._bootstrap>:955: in _find_and_load_unlocked
[    6s]     ???
[    6s] <frozen importlib._bootstrap>:656: in _load_unlocked
[    6s]     ???
[    6s] <frozen importlib._bootstrap>:626: in _load_backward_compatible
[    6s]     ???
[    6s] /usr/lib/python3.6/site-packages/_pytest/assertion/rewrite.py:293: in load_module
[    6s]     six.exec_(co, mod.__dict__)
[    6s] /usr/lib/python3.6/site-packages/trytond/tests/test_tryton.py:44: in <module>
[    6s]     DB_NAME = os.environ['DB_NAME']
[    6s] /usr/lib64/python3.6/os.py:669: in _getitem_
[    6s]     raise KeyError(key) from None
[    6s] E   KeyError: 'DB_NAME'

Axel Braun <coogor>
Project Member
Wed 19 Jan 2022 12:33:03 PM UTC, comment #1: 

Hi, Axel!

Fixed it. Import test modules need to be imported relative to the local dir.

https://hg.savannah.gnu.org/hgweb/health/rev/c069825fc80a

Setup unit testing is deprecated and will be removed.  We should replace it with something like Tox.

I've included in Geany pycodestyle (PEP8)and pyflakes, so most   most packages and their modules have been tested with them. Nevertheless is nice to have automated unit testing :)

Bests
Luis

Luis Falcon <meanmicio>
Project Administrator
Tue 18 Jan 2022 08:08:52 PM UTC, original submission:  

When running tests for GH modules (in this case health) it comes to an error:

[  226s] + PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/gnuhealth-4.0.0a4-lp153.1.1.x86_64/usr/lib/python3.6/site-packages
[  226s] + PYTHONDONTWRITEBYTECODE=1
[  226s] + pytest-3.6 --ignore=_build. --ignore=_build.python3 -v -rs tests
[  226s] ============================= test session starts ==============================
[  226s] platform linux -- Python 3.6.15, pytest-3.10.1, py-1.8.1, pluggy-0.13.1 -- /usr/bin/python3
[  226s] cachedir: .pytest_cache
[  226s] rootdir: /home/abuild/rpmbuild/BUILDROOT/gnuhealth-4.0.0a4-lp153.1.1.x86_64/usr/lib/python3.6/site-packages/trytond/modules/health, inifile:
[  227s] collecting ... collected 0 items / 1 errors
[  227s]
[  227s] ==================================== ERRORS ====================================
[  227s] __________________ ERROR collecting tests/test_health.py ___________________
[  227s] ImportError while importing test module '/home/abuild/rpmbuild/BUILDROOT/gnuhealth-4.0.0a4-lp153.1.1.x86_64/usr/lib/python3.6/site-packages/trytond/modules/health/tests/test_health.py'.
[  227s] Hint: make sure your test modules/packages have valid Python names.
[  227s] Traceback:
[  227s] tests/__init__.py:1: in <module>
[  227s]     from test_health import suite
[  227s] E   ModuleNotFoundError: No module named 'test_health'
[  227s] =============================== warnings summary ===============================
[  227s] /usr/lib64/python3.6/site-packages/genshi/template/interpolation.py:36
[  227s]   /usr/lib64/python3.6/site-packages/genshi/template/interpolation.py:36: DeprecationWarning: Flags not at the start of the expression '[uU]?[rR]?("""|\\\'\\\'\\' (truncated)
[  227s]     PseudoToken

Any idea?

Axel Braun <coogor>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by meanmicio (Posted a comment)
  • -email is unavailable- added by coogor (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-01-19 meanmicio StatusNone Fixed
        ReleaseNone 3.9.0

    Back to the top


    Powered by Savane 3.9