Configuring cover.py with a bulb

I am trying to get coverage.py to work with my flash application.

I am trying to configure it using subprocess instructions: http://nedbatchelder.com/code/coverage/subprocess.html

In my function create_app()(which is a factory application), I have the following:

if settings.FLASK_ENV == 'TEST':
    coverage.process_startup()

In my test suite, I have the following:

# Need to add the 'COVERAGE_PROCESS_START' environment variable for subprocesses
if os.getenv('COVERAGE'):
    test_env['COVERAGE_PROCESS_START'] = 'tests/.coveragerc'

test_env['FLASK_ENV'] = 'TEST'

test_process = subprocess.Popen(["gunicorn", "run_server:app", '--log-level=warning', '-w 1', '-b {host}:{port}'.format(host='127.0.0.1',port=port())],
                                env=test_env)

And at the end of my tests, I do ...

    coverage.save()
    coverage.combine()
    percent_covered = coverage.html_report(directory='covhtml')
    print "Percent Covered: {}".format(percent_covered)
    coverage.stop()

But alas .. coverage reports do not seem to combine

Note: before calling the harvester, if I'm ls -altin the catalog, I see a list like this ...

-rw-r--r-- .coverage.Jonathans-MacBook-Pro-3.local.49352.501916 -rw-r--r-- .coverage.Jonathans-MacBook-Pro-3.local.49352.931352

To complete my .coveragerc just: [run] parallel = True

Would love a point in the right direction - thanks!

+4
2

- @NedBat.

, - , .

, sitepackage.py sitepackage.py. http://nedbatchelder.com/code/coverage/subprocess.html - .

sitepackage.py site-packages. ( ), , .

+1

, . :

nosetests --with-coverage --cover-package=yourpackagename--cover-html --cover-erase
0

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


All Articles