title: PyTest a Pyramid web service and collect coverage information
body: <p>I have a pyramid application that I would like to test from starting the server to going trough all the different views.</p>
  
  <p>I tried using pytest-pyramid-server and pytest-webdriver. </p>
  
  <p>A simple test like</p>
  
  <pre><code>def test_register(pyramid_server):
      assert pyramid_server.uri.startswith('http')
  </code></pre>
  
  <p>That I run with </p>
  
  <pre><code>pytest --cov=./ ./tests/
  </code></pre>
  
  <p>Indeed starts the pyramid application, the test runs but I get 0 coverage information.</p>
  
  <p>This is what I get:</p>
  
  <pre><code>platform linux -- Python 3.6.8, pytest-5.2.1, py-1.8.0, pluggy-0.13.0
  rootdir: /home/cquiros/data/projects2017/personal/software/FormShare, inifile: pytest.ini
  plugins: pyramid-server-1.7.0, shutil-1.7.0, celery-4.3.0, cov-2.8.1, webdriver-1.7.0, server-fixtures-1.7.0
  collected 1 item                                                                                                                        
  
  tests/test_00_manager.py .                                                                                                        [100%]
  
  ----------- coverage: platform linux, python 3.6.8-final-0 -----------
  Name                                                    Stmts   Miss Branch BrPart  Cover
  -----------------------------------------------------------------------------------------
  configure_celery.py                                        21     21      4      0     0%
  create_config.py                                           53     53      6      0     0%
  download_nltk_packages.py                                   1      1      0      0     0%
  formshare/__init__.py                                      21     21      0      0     0%
  formshare/config/__init__.py                                0      0      0      0   100%
  formshare/config/auth.py                                  117    117     36      0     0%
  formshare/config/celery_app.py                             29     29      6      0     0%
  formshare/config/celery_class.py                           44     44      6      0     0%
  formshare/config/celery_config.py                           1      1      0      0     0%
  formshare/config/elasticfeeds.py                           54     54      2      0     0%
  formshare/config/encdecdata.py                             27     27      4      0     0%
  formshare/config/environment.py                            90     90     34      0     0%
  formshare/config/jinja_extensions.py                      106    106     32      0     0%
  formshare/config/mainresources.py                          53     53      0      0     0%
  formshare/config/routes.py                                163    163     16      0     0%
  formshare/i18n/__init__.py                                  0      0      0      0   100%
  formshare/i18n/extract.py                                  17     17      6      0     0%
  formshare/i18n/i18n.py                                     28     28      4      0     0%
  formshare/models/__init__.py                               28     28      2      0     0%
  formshare/models/formshare.py                             264    264      0      0     0%
  formshare/models/meta.py                                    5      5      0      0     0%
  formshare/models/schema.py                                 96     96     90      0     0%
  formshare/plugins/__init__.py                               3      3      0      0     0%
  formshare/plugins/core.py                                  73     73     32      0     0%
  formshare/plugins/helpers.py                               92     92     26      0     0%
  formshare/plugins/interfaces.py                            71     71      2      0     0%
  formshare/plugins/utilities.py                             49     49     10      0     0%
  formshare/processes/__init__.py                             0      0      0      0   100%
  formshare/processes/color_hash.py                          68     68     24      0     0%
  formshare/processes/db/__init__.py                         10     10      0      0     0%
  formshare/processes/db/assistant.py                       160    160     60      0     0%
  formshare/processes/db/assistant_group.py                 105    105     14      0     0%
  formshare/processes/db/celery.py                           27     27      6      0     0%
  formshare/processes/db/collaborator.py                     98     98     24      0     0%
  formshare/processes/db/form.py                            518    518    148      0     0%
  formshare/processes/db/json.py                             46     46      6      0     0%
  formshare/processes/db/products.py                        110    110     32      0     0%
  formshare/processes/db/project.py                         210    210     62      0     0%
  formshare/processes/db/submission.py                       37     37      4      0     0%
  formshare/processes/db/user.py                            116    116     40      0     0%
  formshare/processes/elasticsearch/__init__.py               0      0      0      0   100%
  formshare/processes/elasticsearch/record_index.py          91     91     30      0     0%
  formshare/processes/elasticsearch/repository_index.py     201    201     72      0     0%
  formshare/processes/elasticsearch/user_index.py           132    132     52      0     0%
  formshare/processes/email/__init__.py                       0      0      0      0   100%
  formshare/processes/email/send_async_email.py              48     48     20      0     0%
  formshare/processes/email/send_email.py                    52     52     14      0     0%
  formshare/processes/odk/__init__.py                         1      1      0      0     0%
  formshare/processes/odk/api.py                           1081   1081    320      0     0%
  formshare/processes/odk/processes.py                      266    266     72      0     0%
  formshare/processes/sse/__init__.py                         0      0      0      0   100%
  formshare/processes/sse/messaging.py                       25     25      0      0     0%
  formshare/processes/storage/__init__.py                     1      1      0      0     0%
  formshare/processes/storage/local_storage.py              101    101     12      0     0%
  formshare/processes/submission/__init__.py                  0      0      0      0   100%
  formshare/processes/submission/api.py                     635    635    244      0     0%
  formshare/products/__init__.py                              1      1      0      0     0%
  formshare/products/export/__init__.py                       0      0      0      0   100%
  formshare/products/export/csv/__init__.py                   1      1      0      0     0%
  formshare/products/export/csv/celery_task.py              187    187     84      0     0%
  formshare/products/export/csv/csv.py                       26     26      8      0     0%
  formshare/products/export/kml/__init__.py                   1      1      0      0     0%
  formshare/products/export/kml/celery_task.py               55     55     20      0     0%
  formshare/products/export/kml/kml.py                       15     15      4      0     0%
  formshare/products/export/media/__init__.py                 1      1      0      0     0%
  formshare/products/export/media/celery_task.py             73     73     28      0     0%
  formshare/products/export/media/media.py                   15     15      4      0     0%
  formshare/products/export/xlsx/__init__.py                  1      1      0      0     0%
  formshare/products/export/xlsx/celery_task.py              44     44      6      0     0%
  formshare/products/export/xlsx/xlsx.py                     26     26      8      0     0%
  formshare/products/formshare_products.py                   49     49      0      0     0%
  formshare/products/fs1import/__init__.py                    0      0      0      0   100%
  formshare/products/fs1import/celery_task.py               143    143     36      0     0%
  formshare/products/fs1import/fs1import.py                   9      9      4      0     0%
  formshare/products/merge/__init__.py                        1      1      0      0     0%
  formshare/products/merge/celery_task.py                   300    300    100      0     0%
  formshare/products/merge/merge.py                          11     11      4      0     0%
  formshare/products/products.py                            110    110     60      0     0%
  formshare/products/repository/__init__.py                   1      1      0      0     0%
  formshare/products/repository/celery_task.py              149    149     40      0     0%
  formshare/products/repository/repository.py                11     11      4      0     0%
  formshare/resources/__init__.py                             1      1      0      0     0%
  formshare/resources/resources.py                          116    116     80      0     0%
  formshare/scripts/__init__.py                               0      0      0      0   100%
  formshare/scripts/configurealembic.py                      36     36      6      0     0%
  formshare/scripts/configurefluent.py                       17     17      0      0     0%
  formshare/scripts/configuremysql.py                        39     39      6      0     0%
  formshare/scripts/createsuperuser.py                       61     61     16      0     0%
  formshare/views/__init__.py                                 0      0      0      0   100%
  formshare/views/api.py                                     33     33     16      0     0%
  formshare/views/assistant_groups.py                       218    218    100      0     0%
  formshare/views/assistant_views/__init__.py                 0      0      0      0   100%
  formshare/views/assistant_views/clean.py                  129    129     60      0     0%
  formshare/views/assistant_views/forms.py                   75     75     20      0     0%
  formshare/views/assistant_views/jsonlogs.py               318    318    130      0     0%
  formshare/views/assistants.py                             187    187     90      0     0%
  formshare/views/basic_views.py                            262    262    104      0     0%
  formshare/views/classes.py                                339    339    122      0     0%
  formshare/views/collaborators.py                          118    118     56      0     0%
  formshare/views/dashboard.py                               45     45     22      0     0%
  formshare/views/form.py                                  1289   1289    576      0     0%
  formshare/views/notfound.py                                 4      4      0      0     0%
  formshare/views/odk.py                                    104    104     46      0     0%
  formshare/views/products.py                               206    206     86      0     0%
  formshare/views/profile.py                                 59     59     28      0     0%
  formshare/views/projects.py                               393    393    158      0     0%
  formshare/views/repository.py                             176    176     94      0     0%
  formshare/views/repository_dictionary.py                  109    109     54      0     0%
  formshare/views/repository_merge.py                       106    106     38      0     0%
  formshare/views/repository_submissions.py                 240    240    116      0     0%
  formshare/views/sse.py                                     83     83     28      0     0%
  formshare/views/users.py                                  164    164     70      0     0%
  setup.py                                                   12     12      0      0     0%
  tests/conftest.py                                           1      0      0      0   100%
  tests/test_00_manager.py                                    2      0      0      0   100%
  -----------------------------------------------------------------------------------------
  TOTAL                                                   11817  11814   4106      0     1%
  </code></pre>
  
  <p>My .coveragerc has:</p>
  
  <pre><code># .coveragerc to control coverage.py
  [run]
  branch = True
  source = formshare
  # omit = bad_file.py
  
  [paths]
  source =
      formshare/
      */site-packages/
  
  [report]
  # Regexes for lines to exclude from consideration
  exclude_lines =
      # Have to re-enable the standard pragma
      pragma: no cover
  
      # Don't complain about missing debug-only code:
      def __repr__
      if self\.debug
  
      # Don't complain if tests don't hit defensive assertion code:
      raise AssertionError
      raise NotImplementedError
  
      # Don't complain if non-runnable code isn't run:
      if 0:
      if __name__ == .__main__.:
  </code></pre>
  
  <p>I been looking around for examples or tutorials but I just cannot find anything that would help me solve the coverage issue.</p>
  
  <p>Any idea is appreciated</p>