Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master into features #2790

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
10d43bd
Set xfail_strict=True in pytest's own test suite
nicoddemus Sep 5, 2017
6cf515b
Fix crash in FastFilesCompleter with no prefix
evanunderscore Sep 4, 2017
b2a8e06
add warning to skipping docs re marker inheritance
Sep 8, 2017
1e93089
[bugfix] Checking MarkDecorator equality returns False for non-MarkDe…
seanluong Sep 9, 2017
25ed4ed
Merge pull request #2764 from xuanluong/issue-2758-fix-mark-decorator…
RonnyPfannschmidt Sep 9, 2017
3c1ca03
Merge pull request #2763 from jhamman/docs/skipif_class_warning
nicoddemus Sep 9, 2017
15222ce
Fix typo in example of passing a callable to markers
seanluong Sep 9, 2017
e27a0d6
Rename changelog file to PR id number
seanluong Sep 9, 2017
bee2c86
Merge pull request #2765 from xuanluong/pass-callable-to-marker-typo
nicoddemus Sep 10, 2017
696c702
Update documentation on multiple calls of metafunc.parametrize
seanluong Sep 10, 2017
e57cc55
Merge pull request #2766 from xuanluong/issue-1548-docs-multiple-call…
nicoddemus Sep 10, 2017
abfd977
Remove xfail mark from passing test in py26
nicoddemus Sep 12, 2017
70cdfaf
Merge pull request #2754 from nicoddemus/xfail_strict
RonnyPfannschmidt Sep 13, 2017
52c134a
Add development guide to docs
nicoddemus Sep 7, 2017
25d2acb
Merge pull request #2760 from nicoddemus/labels
nicoddemus Sep 14, 2017
810320f
Small fixes to development_guide: title and label names
nicoddemus Sep 14, 2017
ac5c5cc
Merge pull request #2750 from evanunderscore/fix-filescompleter
nicoddemus Sep 14, 2017
9933635
Change to py36 as main environment for Python 3 environments in tox
nicoddemus Sep 16, 2017
bf77daa
Merge pull request #2785 from nicoddemus/py36
RonnyPfannschmidt Sep 17, 2017
3ebfb88
Merge remote-tracking branch 'upstream/master' into features
nicoddemus Sep 18, 2017
afe7966
Fix call to outcome.get_result now that outcome.result is deprecated
nicoddemus Sep 19, 2017
a2da5a6
Update tox and appveyor environments to use py36 by default
nicoddemus Sep 19, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ env:
- TOXENV=py27-trial
- TOXENV=py27-numpy
- TOXENV=py27-pluggymaster
- TOXENV=py35-pexpect
- TOXENV=py35-xdist
- TOXENV=py35-trial
- TOXENV=py35-numpy
- TOXENV=py35-pluggymaster
- TOXENV=py36-pexpect
- TOXENV=py36-xdist
- TOXENV=py36-trial
- TOXENV=py36-numpy
- TOXENV=py36-pluggymaster
- TOXENV=py27-nobyte
- TOXENV=doctesting
- TOXENV=docs
Expand Down
12 changes: 8 additions & 4 deletions HOWTORELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
How to release pytest
--------------------------------------------
Release Procedure
-----------------

Our current policy for releasing is to aim for a bugfix every few weeks and a minor release every 2-3 months. The idea
is to get fixes and new features out instead of trying to cram a ton of features into a release and by consequence
taking a lot of time to make a new one.

.. important::

Expand All @@ -21,7 +25,7 @@ How to release pytest
#. Generate docs, changelog, announcements and upload a package to
your ``devpi`` staging server::

invoke generate.pre_release <VERSION> <DEVPI USER> --password <DEVPI PASSWORD>
invoke generate.pre-release <VERSION> <DEVPI USER> --password <DEVPI PASSWORD>

If ``--password`` is not given, it is assumed the user is already logged in ``devpi``.
If you don't have an account, please ask for one.
Expand Down Expand Up @@ -49,7 +53,7 @@ How to release pytest

#. Publish to PyPI::

invoke generate.publish_release <VERSION> <DEVPI USER> <PYPI_NAME>
invoke generate.publish-release <VERSION> <DEVPI USER> <PYPI_NAME>

where PYPI_NAME is the name of pypi.python.org as configured in your ``~/.pypirc``
file `for devpi <http://doc.devpi.net/latest/quickstart-releaseprocess.html?highlight=pypirc#devpi-push-releasing-to-an-external-index>`_.
Expand Down
5 changes: 3 additions & 2 deletions _pytest/_argcomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def __call__(self, prefix, **kwargs):
completion = []
globbed = []
if '*' not in prefix and '?' not in prefix:
if prefix[-1] == os.path.sep: # we are on unix, otherwise no bash
# we are on unix, otherwise no bash
if not prefix or prefix[-1] == os.path.sep:
globbed.extend(glob(prefix + '.*'))
prefix += '*'
globbed.extend(glob(prefix))
Expand All @@ -98,7 +99,7 @@ def __call__(self, prefix, **kwargs):
filescompleter = FastFilesCompleter()

def try_argcomplete(parser):
argcomplete.autocomplete(parser)
argcomplete.autocomplete(parser, always_complete_options=False)
else:
def try_argcomplete(parser):
pass
Expand Down
2 changes: 1 addition & 1 deletion _pytest/mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def markname(self):
return self.name # for backward-compat (2.4.1 had this attr)

def __eq__(self, other):
return self.mark == other.mark
return self.mark == other.mark if isinstance(other, MarkDecorator) else False

def __repr__(self):
return "<MarkDecorator %r>" % (self.mark,)
Expand Down
10 changes: 5 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ environment:
- TOXENV: "py27-trial"
- TOXENV: "py27-numpy"
- TOXENV: "py27-pluggymaster"
- TOXENV: "py35-pexpect"
- TOXENV: "py35-xdist"
- TOXENV: "py35-trial"
- TOXENV: "py35-numpy"
- TOXENV: "py35-pluggymaster"
- TOXENV: "py36-pexpect"
- TOXENV: "py36-xdist"
- TOXENV: "py36-trial"
- TOXENV: "py36-numpy"
- TOXENV: "py36-pluggymaster"
- TOXENV: "py27-nobyte"
- TOXENV: "doctesting"
- TOXENV: "py35-freeze"
Expand Down
1 change: 1 addition & 0 deletions changelog/1548.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add note in ``parametrize.rst`` about calling ``metafunc.parametrize`` multiple times.
1 change: 1 addition & 0 deletions changelog/2722.trivial
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set ``xfail_strict=True`` in pytest's own test suite to catch expected failures as soon as they start to pass.
1 change: 1 addition & 0 deletions changelog/2748.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix crash in tab completion when no prefix is given.
1 change: 1 addition & 0 deletions changelog/2758.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The equality checking function (``__eq__``) of ``MarkDecorator`` returns ``False`` if one object is not an instance of ``MarkDecorator``.
1 change: 1 addition & 0 deletions changelog/2765.trivial
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix typo in example of passing a callable to markers (in example/markers.rst)
1 change: 1 addition & 0 deletions doc/en/contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Full pytest documentation
historical-notes
license
contributing
development_guide
talks
projects
faq
Expand Down
108 changes: 108 additions & 0 deletions doc/en/development_guide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
=================
Development Guide
=================

Some general guidelines regarding development in pytest for core maintainers and general contributors. Nothing here
is set in stone and can't be changed, feel free to suggest improvements or changes in the workflow.


Code Style
----------

* `PEP-8 <https://www.python.org/dev/peps/pep-0008>`_
* `flake8 <https://pypi.python.org/pypi/flake8>`_ for quality checks
* `invoke <http://www.pyinvoke.org/>`_ to automate development tasks


Branches
--------

We have two long term branches:

* ``master``: contains the code for the next bugfix release.
* ``features``: contains the code with new features for the next minor release.

The official repository usually does not contain topic branches, developers and contributors should create topic
branches in their own forks.

Exceptions can be made for cases where more than one contributor is working on the same
topic or where it makes sense to use some automatic capability of the main repository, such as automatic docs from
`readthedocs <readthedocs.org>`_ for a branch dealing with documentation refactoring.

Issues
------

Any question, feature, bug or proposal is welcome as an issue. Users are encouraged to use them whenever they need.

GitHub issues should use labels to categorize them. Labels should be created sporadically, to fill a niche; we should
avoid creating labels just for the sake of creating them.

Here is a list of labels and a brief description mentioning their intent.


**Type**

* ``type: backward compatibility``: issue that will cause problems with old pytest versions.
* ``type: bug``: problem that needs to be addressed.
* ``type: deprecation``: feature that will be deprecated in the future.
* ``type: docs``: documentation missing or needing clarification.
* ``type: enhancement``: new feature or API change, should be merged into ``features``.
* ``type: feature-branch``: new feature or API change, should be merged into ``features``.
* ``type: infrastructure``: improvement to development/releases/CI structure.
* ``type: performance``: performance or memory problem/improvement.
* ``type: proposal``: proposal for a new feature, often to gather opinions or design the API around the new feature.
* ``type: question``: question regarding usage, installation, internals or how to test something.
* ``type: refactoring``: internal improvements to the code.
* ``type: regression``: indicates a problem that was introduced in a release which was working previously.

**Status**

* ``status: critical``: grave problem or usability issue that affects lots of users.
* ``status: easy``: easy issue that is friendly to new contributors.
* ``status: help wanted``: core developers need help from experts on this topic.
* ``status: needs information``: reporter needs to provide more information; can be closed after 2 or more weeks of inactivity.

**Topic**

* ``topic: collection``
* ``topic: fixtures``
* ``topic: parametrize``
* ``topic: reporting``
* ``topic: selection``
* ``topic: tracebacks``

**Plugin (internal or external)**

* ``plugin: cache``
* ``plugin: capture``
* ``plugin: doctests``
* ``plugin: junitxml``
* ``plugin: monkeypatch``
* ``plugin: nose``
* ``plugin: pastebin``
* ``plugin: pytester``
* ``plugin: tmpdir``
* ``plugin: unittest``
* ``plugin: warnings``
* ``plugin: xdist``


**OS**

Issues specific to a single operating system. Do not use as a means to indicate where an issue originated from, only
for problems that happen **only** in that system.

* ``os: linux``
* ``os: mac``
* ``os: windows``

**Temporary**

Used to classify issues for limited time, to help find issues related in events for example.
They should be removed after they are no longer relevant.

* ``temporary: EP2017 sprint``:
* ``temporary: sprint-candidate``:


.. include:: ../../HOWTORELEASE.rst
2 changes: 1 addition & 1 deletion doc/en/example/markers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ The output is as follows::
.
1 passed in 0.12 seconds

We can see that the custom marker has its argument set extended with the function ``hello_world``. This is the key different between creating a custom marker as a callable, which invokes ``__call__`` behind the scenes, and using ``with_args``.
We can see that the custom marker has its argument set extended with the function ``hello_world``. This is the key difference between creating a custom marker as a callable, which invokes ``__call__`` behind the scenes, and using ``with_args``.


Reading markers which were set from multiple places
Expand Down
4 changes: 4 additions & 0 deletions doc/en/parametrize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ list::
SKIP [1] test_strings.py:2: got empty parameter set ['stringinput'], function test_valid_string at $REGENDOC_TMPDIR/test_strings.py:1
1 skipped in 0.12 seconds


Note that when calling ``metafunc.parametrize`` multiple times with different parameter sets, all parameter names across
those sets cannot be duplicated, otherwise an error will be raised.

For further examples, you might want to look at :ref:`more
parametrization examples <paramexamples>`.

Expand Down
18 changes: 11 additions & 7 deletions doc/en/skipping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ by calling the ``pytest.skip(reason)`` function:
if not valid_config():
pytest.skip("unsupported configuration")

The imperative method is useful when it is not possible to evaluate the skip condition
The imperative method is useful when it is not possible to evaluate the skip condition
during import time.

``skipif``
Expand All @@ -73,7 +73,7 @@ when run on a Python3.3 interpreter::
...

If the condition evaluates to ``True`` during collection, the test function will be skipped,
with the specified reason appearing in the summary when using ``-rs``.
with the specified reason appearing in the summary when using ``-rs``.

You can share ``skipif`` markers between modules. Consider this test module::

Expand Down Expand Up @@ -118,6 +118,12 @@ You can use the ``skipif`` marker (as any other marker) on classes::
If the condition is ``True``, this marker will produce a skip result for
each of the test methods of that class.

.. warning::

The use of ``skipif`` on classes that use inheritance is strongly
discouraged. `A Known bug <https://github.com/pytest-dev/pytest/issues/568>`_
in pytest's markers may cause unexpected behavior in super classes.

If you want to skip all test functions of a module, you may use
the ``pytestmark`` name on the global level:

Expand Down Expand Up @@ -305,12 +311,12 @@ Running it with the report-on-xfail option gives this output::
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR/example, inifile:
collected 7 items

xfail_demo.py xxxxxxx
======= short test summary info ========
XFAIL xfail_demo.py::test_hello
XFAIL xfail_demo.py::test_hello2
reason: [NOTRUN]
reason: [NOTRUN]
XFAIL xfail_demo.py::test_hello3
condition: hasattr(os, 'sep')
XFAIL xfail_demo.py::test_hello4
Expand All @@ -320,7 +326,7 @@ Running it with the report-on-xfail option gives this output::
XFAIL xfail_demo.py::test_hello6
reason: reason
XFAIL xfail_demo.py::test_hello7

======= 7 xfailed in 0.12 seconds ========

.. _`skip/xfail with parametrize`:
Expand All @@ -346,5 +352,3 @@ test instances when using parametrize:
])
def test_increment(n, expected):
assert n + 1 == expected


1 change: 0 additions & 1 deletion testing/code/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ def g():
assert lines == ['', 'def f():', ' def g():', ' pass', ' ']


@pytest.mark.xfail("sys.version_info[:3] < (2,7,0)")
def test_source_of_class_at_eof_without_newline(tmpdir):
# this test fails because the implicit inspect.getsource(A) below
# does not return the "x = 1" last line.
Expand Down
2 changes: 1 addition & 1 deletion testing/python/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ def test_customized_pymakeitem(self, testdir):
def pytest_pycollect_makeitem():
outcome = yield
if outcome.excinfo is None:
result = outcome.result
result = outcome.get_result()
if result:
for func in result:
func._some123 = "world"
Expand Down
2 changes: 1 addition & 1 deletion testing/test_argcomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_compare_with_compgen(self):
from _pytest._argcomplete import FastFilesCompleter
ffc = FastFilesCompleter()
fc = FilesCompleter()
for x in '/ /d /data qqq'.split():
for x in ['/', '/d', '/data', 'qqq', '']:
assert equal_with_bash(x, ffc, fc, out=py.std.sys.stdout)

@pytest.mark.skipif("sys.platform in ('win32', 'darwin')")
Expand Down
12 changes: 12 additions & 0 deletions testing/test_mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,3 +812,15 @@ def fake_method(self):
assert fake_method.fun
# pristine marks dont transfer
assert fake_method.pytestmark == [pytest.mark.fun.mark]


class TestMarkDecorator(object):

@pytest.mark.parametrize('lhs, rhs, expected', [
(pytest.mark.foo(), pytest.mark.foo(), True),
(pytest.mark.foo(), pytest.mark.bar(), False),
(pytest.mark.foo(), 'bar', False),
('foo', pytest.mark.bar(), False)
])
def test__eq__(self, lhs, rhs, expected):
assert (lhs == rhs) == expected
Loading