Commit e679f354 authored by André Anjos's avatar André Anjos 💬

Merge branch 'pytest' into 'master'

Pytest

See merge request !41
parents f5ffb964 edc4edcf
Pipeline #45595 passed with stages
in 3 minutes and 4 seconds
......@@ -18,3 +18,5 @@ build
*.egg
src/
record.txt
.coverage
coverage.xml
......@@ -139,6 +139,37 @@ class NoseTests(Script):
update = install
class PyTest(Script):
"""Installs pytest infrastructure"""
def __init__(self, buildout, name, options):
self.name = name
self.buildout = buildout
self.options = options
if 'interpreter' in options: del options['interpreter']
if 'pytest-flags' in options:
# use 'options' instead of 'options' to force use
flags = tools.parse_list(options['pytest-flags'])
init_code = ['sys.argv.append(%r)' % k for k in flags]
options['initialization'] = '\n'.join(init_code)
self.options['entry-points'] = 'pytest=pytest:console_main'
self.options['scripts'] = 'pytest'
self.options['dependent-scripts'] = 'false'
eggs = tools.eggs(self.buildout['buildout'], self.options, self.name)
self.options['eggs'] = tools.add_eggs(eggs, ['pytest', 'pytest-cov'])
# initializes base class
super(PyTest, self).__init__(self.buildout, self.name, self.options)
def install(self):
return super(PyTest, self).install()
update = install
class Coverage(Script):
"""Installs Coverage infrastructure"""
......@@ -231,6 +262,7 @@ class Recipe(object):
options.copy())
self.scripts = UserScripts(buildout, 'Scripts', options.copy())
self.nose = NoseTests(buildout, 'Nose', options.copy())
self.pytest = PyTest(buildout, 'PyTest', options.copy())
self.coverage = Coverage(buildout, 'Coverage', options.copy())
self.sphinx = Sphinx(buildout, 'Sphinx', options.copy())
......@@ -241,6 +273,7 @@ class Recipe(object):
self.dbpy.install_on_wrapped_env() + \
self.scripts.install_on_wrapped_env() + \
self.nose.install_on_wrapped_env() + \
self.pytest.install_on_wrapped_env() + \
self.coverage.install_on_wrapped_env() + \
self.sphinx.install_on_wrapped_env()
......
This diff is collapsed.
{% set name = 'bob.buildout' %}
{% set project_dir = environ.get('RECIPE_DIR') + '/..' %}
package:
name: {{ name }}
......@@ -9,7 +10,7 @@ build:
run_exports:
- {{ pin_subpackage(name) }}
script:
- cd {{ environ.get('RECIPE_DIR') + '/..' }}
- cd {{ project_dir }}
{% if environ.get('BUILD_EGG') %}
- python setup.py sdist --formats=zip
{% endif %}
......@@ -29,24 +30,24 @@ requirements:
- setuptools
- zc.recipe.egg
- nose
- pytest
- pytest-cov
- coverage
- sphinx
- sphinx_rtd_theme
test:
imports:
- {{ name }}
commands:
- nosetests --with-coverage --cover-package={{ name }} -sv {{ name }}
- sphinx-build -aEW ${PREFIX}/share/doc/{{ name }}/doc sphinx
- if [ -n "${CI_PROJECT_DIR}" ]; then mv sphinx "${CI_PROJECT_DIR}/"; fi
- sphinx-build -aEb doctest ${PREFIX}/share/doc/{{ name }}/doc sphinx
# runs tests for package only, report only what is in the package
# creates html and xml reports and place them in specific directories
- pytest --verbose --cov {{ name }} --cov-report term-missing --cov-report html:{{ project_dir }}/sphinx/coverage --cov-report xml:{{ project_dir }}/coverage.xml --pyargs {{ name }}
- conda inspect linkages -p $PREFIX {{ name }} # [not win]
- conda inspect objects -p $PREFIX {{ name }} # [osx]
requires:
- nose
- coverage
- sphinx
- sphinx_rtd_theme
about:
home: https://www.idiap.ch/software/bob/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment