merge with master

This commit is contained in:
Anatoly Bubenkov 2014-07-24 17:38:42 +02:00
commit 15f95dfdba
8 changed files with 44 additions and 27 deletions

View File

@ -7,6 +7,12 @@ Changelog
- Implemented cucumber json formatter (bubenkoff, albertjan)
2.1.1
-----
- Bugfixes (bubenkoff)
2.1.0
-----

View File

@ -236,8 +236,8 @@ Scenario parameters
-------------------
Scenario decorator can accept such optional keyword arguments:
* `encoding` - decode content of feature file in specific encoding. UTF-8 is default.
* `example_converters` - mapping to pass functions to convert example values provided in feature files.
* ``encoding`` - decode content of feature file in specific encoding. UTF-8 is default.
* ``example_converters`` - mapping to pass functions to convert example values provided in feature files.
Scenario outlines
@ -508,9 +508,9 @@ collected from the parent conftests.
Feature file paths
------------------
But default, pytest-bdd will use current modules path as base path for
But default, pytest-bdd will use current module's path as base path for
finding feature files, but this behaviour can be changed by having
fixture named pytestbdd_feature_base_dir which should return the
fixture named ``pytestbdd_feature_base_dir`` which should return the
new base path.
test_publish_article.py:
@ -591,8 +591,7 @@ Browser testing
Tools recommended to use for browser testing:
* `pytest-splinter <https://github.com/paylogic/pytest-splinter>`_
- pytest `splinter <http://splinter.cobrateam.info/>`_ integration for the real browser testing
* `pytest-splinter <https://github.com/paylogic/pytest-splinter>`_ - pytest `splinter <http://splinter.cobrateam.info/>`_ integration for the real browser testing
Reporting
@ -621,6 +620,7 @@ decorator. Reasons for that:
* after moving to parsing-on-import-time approach for feature files, it's not possible to detect whether it's a
decorator more or not, so to support it along with functional approach there needed to be special parameter
for that, which is also a backwards-incompartible change.
To help users migrate to newer version, there's migration console script provided with **migrate** extra:
::

View File

@ -11,12 +11,15 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import pytest_bdd
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
import sys, os
sys.path.insert(0, os.path.abspath('..'))
import pytest_bdd
# -- General configuration -----------------------------------------------------

View File

@ -1,4 +1,11 @@
from pytest_bdd.steps import given, when, then # pragma: no cover
from pytest_bdd.scenario import scenario # pragma: no cover
"""pytest-bdd public api."""
__version__ = '2.2.0'
__all__ = [given.__name__, when.__name__, then.__name__, scenario.__name__] # pragma: no cover
try:
from pytest_bdd.steps import given, when, then # pragma: no cover
from pytest_bdd.scenario import scenario # pragma: no cover
__all__ = [given.__name__, when.__name__, then.__name__, scenario.__name__] # pragma: no cover
except ImportError:
# avoid import errors when only __version__ is needed (for setup.py)
pass

View File

@ -11,7 +11,7 @@ MIGRATE_REGEX = re.compile(r'\s?(\w+)\s\=\sscenario\((.+)\)', flags=re.MULTILINE
def migrate_tests():
"""Migrate outdated tests to the most recent form."""
if len(sys.argv) != 2:
print 'Usage: pytestbdd_migrate_tests <path>'
print('Usage: pytestbdd_migrate_tests <path>')
sys.exit(1)
path = sys.argv[1]
for file_path in glob2.iglob(os.path.join(os.path.abspath(path), '**', '*.py')):

View File

@ -1,15 +1,18 @@
#!/usr/bin/env python
"""pytest-bdd package config."""
import codecs
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
version = '2.2.0'
import pytest_bdd
class Tox(TestCommand):
""""Custom setup.py test command implementation using tox runner."""
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = ['--recreate']
@ -25,8 +28,8 @@ class Tox(TestCommand):
dirname = os.path.dirname(__file__)
long_description = (
open(os.path.join(dirname, 'README.rst')).read() + '\n' +
open(os.path.join(dirname, 'CHANGES.rst')).read()
codecs.open(os.path.join(dirname, 'README.rst'), encoding='utf-8').read() + '\n' +
codecs.open(os.path.join(dirname, 'CHANGES.rst'), encoding='utf-8').read()
)
setup(
@ -35,9 +38,9 @@ setup(
long_description=long_description,
author='Oleg Pidsadnyi',
license='MIT license',
author_email='oleg.podsadny@gmail.com',
author_email='oleg.pidsadnyi@gmail.com',
url='https://github.com/olegpidsadnyi/pytest-bdd',
version=version,
version=pytest_bdd.__version__,
classifiers=[
'Development Status :: 6 - Mature',
'Intended Audience :: Developers',

View File

@ -229,20 +229,20 @@ def test_step_trace(testdir):
""")
result = testdir.runpytest('-k test_when_fails_inline', '-vv')
assert result.ret == 1
result.stdout.fnmatch_lines('test_step_trace.py:*: test_when_fails_inline FAILED')
result.stdout.fnmatch_lines(['*test_when_fails_inline FAILED'])
assert 'INTERNALERROR' not in result.stdout.str()
result = testdir.runpytest('-k test_when_fails_decorated', '-vv')
assert result.ret == 1
result.stdout.fnmatch_lines('test_step_trace.py:*: test_when_fails_decorated FAILED')
result.stdout.fnmatch_lines(['*test_when_fails_decorated FAILED'])
assert 'INTERNALERROR' not in result.stdout.str()
result = testdir.runpytest('-k test_when_not_found', '-vv')
assert result.ret == 1
result.stdout.fnmatch_lines('test_step_trace.py:*: test_when_not_found FAILED')
result.stdout.fnmatch_lines(['*test_when_not_found FAILED'])
assert 'INTERNALERROR' not in result.stdout.str()
result = testdir.runpytest('-k test_when_step_validation_error', '-vv')
assert result.ret == 1
result.stdout.fnmatch_lines('test_step_trace.py:*: test_when_step_validation_error FAILED')
result.stdout.fnmatch_lines(['*test_when_step_validation_error FAILED'])
assert 'INTERNALERROR' not in result.stdout.str()

View File

@ -1,8 +1,6 @@
[tox]
distshare={homedir}/.tox/distshare
envlist=py26,py27,py27-xdist,py27-pytest-latest,py34
indexserver=
pypi = https://pypi.python.org/simple
envlist=py26,py27,py27-xdist,py27-pytest-latest,py33,py34
[testenv]
commands= py.test pytest_bdd tests --pep8 --junitxml={envlogdir}/junit-{envname}.xml