Launch Coated Nose2 for Installed Packaging

I got some of our project packages installed in a venvjenkins job. After installation, the task pulls some unittests from a separate repository and runs them against the installed package.

My problem coveragecovers only test scripts, but not installed packages.

Here is the folder structure:

JenkinsWorkspace
|_Venv
|_MyProject
  |_trunk
    |_Python   
    |_Package1
    |_Package2
      |_temp_tests
        |_test_suite1.py
        |_...

So, for further explanation, I iterate over the packages in MyProject, check the tests for each in temp_tests, cdin temp_testsand callnose2 -t ..\..\..\Venv\Lib\site-packages

, -t . , . coverage . ?

my unittest.cfg:

[coverage]
coverage-report = term-missing
always-on = True
coverage-config = .coveragerc

[junit-xml]
always-on = True
keep_restricted = False
path = nose2-junit.xml
test_fullname = False

.coveragerc:

# .coveragerc
[run]
branch = True
[report]
show_missing = True
omit = 
    build/*
    tests/*
    setup.py
    */__init__.py
+4
2

, coverage .

:

nose2 --plugin nose2.plugins.junitxml -s tests -c unittest.cfg
python -m coverage xml

tests .

unittest.cfg :

[coverage]
coverage-report = term-missing
always-on = True
coverage-config = .coveragerc

[junit-xml]
always-on = True
keep_restricted = False
path = nose2-junit.xml
test_fullname = False

.coveragerc () :

# .coveragerc
[run]
branch = True
[report]
show_missing = True
omit = 
    build/*
    tests/*
    setup.py
    */__init__.py
    */nose/*
    */pkg_resources/*
    */six.py
    */nose2/*
    */coverage/*
    */cov_core.py
0

2 PATH, , --coverage PATH. PATH . :

nose2 -t ..\..\..\Venv\Lib\site-packages --coverage ..\..\..\Venv\Lib\site-packages
0

Source: https://habr.com/ru/post/1684374/


All Articles