Skip to content

Commit de0d19c

Browse files
Merge pull request #2790 from nicoddemus/merge-master-into-features
Merge master into features
2 parents 9273e11 + a2da5a6 commit de0d19c

20 files changed

+172
-35
lines changed

.travis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ env:
2020
- TOXENV=py27-trial
2121
- TOXENV=py27-numpy
2222
- TOXENV=py27-pluggymaster
23-
- TOXENV=py35-pexpect
24-
- TOXENV=py35-xdist
25-
- TOXENV=py35-trial
26-
- TOXENV=py35-numpy
27-
- TOXENV=py35-pluggymaster
23+
- TOXENV=py36-pexpect
24+
- TOXENV=py36-xdist
25+
- TOXENV=py36-trial
26+
- TOXENV=py36-numpy
27+
- TOXENV=py36-pluggymaster
2828
- TOXENV=py27-nobyte
2929
- TOXENV=doctesting
3030
- TOXENV=docs

HOWTORELEASE.rst

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
How to release pytest
2-
--------------------------------------------
1+
Release Procedure
2+
-----------------
3+
4+
Our current policy for releasing is to aim for a bugfix every few weeks and a minor release every 2-3 months. The idea
5+
is to get fixes and new features out instead of trying to cram a ton of features into a release and by consequence
6+
taking a lot of time to make a new one.
37

48
.. important::
59

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

24-
invoke generate.pre_release <VERSION> <DEVPI USER> --password <DEVPI PASSWORD>
28+
invoke generate.pre-release <VERSION> <DEVPI USER> --password <DEVPI PASSWORD>
2529

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

5054
#. Publish to PyPI::
5155

52-
invoke generate.publish_release <VERSION> <DEVPI USER> <PYPI_NAME>
56+
invoke generate.publish-release <VERSION> <DEVPI USER> <PYPI_NAME>
5357

5458
where PYPI_NAME is the name of pypi.python.org as configured in your ``~/.pypirc``
5559
file `for devpi <http://doc.devpi.net/latest/quickstart-releaseprocess.html?highlight=pypirc#devpi-push-releasing-to-an-external-index>`_.

_pytest/_argcomplete.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def __call__(self, prefix, **kwargs):
7878
completion = []
7979
globbed = []
8080
if '*' not in prefix and '?' not in prefix:
81-
if prefix[-1] == os.path.sep: # we are on unix, otherwise no bash
81+
# we are on unix, otherwise no bash
82+
if not prefix or prefix[-1] == os.path.sep:
8283
globbed.extend(glob(prefix + '.*'))
8384
prefix += '*'
8485
globbed.extend(glob(prefix))
@@ -98,7 +99,7 @@ def __call__(self, prefix, **kwargs):
9899
filescompleter = FastFilesCompleter()
99100

100101
def try_argcomplete(parser):
101-
argcomplete.autocomplete(parser)
102+
argcomplete.autocomplete(parser, always_complete_options=False)
102103
else:
103104
def try_argcomplete(parser):
104105
pass

_pytest/mark.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def markname(self):
326326
return self.name # for backward-compat (2.4.1 had this attr)
327327

328328
def __eq__(self, other):
329-
return self.mark == other.mark
329+
return self.mark == other.mark if isinstance(other, MarkDecorator) else False
330330

331331
def __repr__(self):
332332
return "<MarkDecorator %r>" % (self.mark,)

appveyor.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ environment:
2222
- TOXENV: "py27-trial"
2323
- TOXENV: "py27-numpy"
2424
- TOXENV: "py27-pluggymaster"
25-
- TOXENV: "py35-pexpect"
26-
- TOXENV: "py35-xdist"
27-
- TOXENV: "py35-trial"
28-
- TOXENV: "py35-numpy"
29-
- TOXENV: "py35-pluggymaster"
25+
- TOXENV: "py36-pexpect"
26+
- TOXENV: "py36-xdist"
27+
- TOXENV: "py36-trial"
28+
- TOXENV: "py36-numpy"
29+
- TOXENV: "py36-pluggymaster"
3030
- TOXENV: "py27-nobyte"
3131
- TOXENV: "doctesting"
3232
- TOXENV: "py35-freeze"

changelog/1548.doc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add note in ``parametrize.rst`` about calling ``metafunc.parametrize`` multiple times.

changelog/2722.trivial

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Set ``xfail_strict=True`` in pytest's own test suite to catch expected failures as soon as they start to pass.

changelog/2748.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix crash in tab completion when no prefix is given.

changelog/2758.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The equality checking function (``__eq__``) of ``MarkDecorator`` returns ``False`` if one object is not an instance of ``MarkDecorator``.

changelog/2765.trivial

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix typo in example of passing a callable to markers (in example/markers.rst)

doc/en/contents.rst

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Full pytest documentation
4141
historical-notes
4242
license
4343
contributing
44+
development_guide
4445
talks
4546
projects
4647
faq

doc/en/development_guide.rst

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
=================
2+
Development Guide
3+
=================
4+
5+
Some general guidelines regarding development in pytest for core maintainers and general contributors. Nothing here
6+
is set in stone and can't be changed, feel free to suggest improvements or changes in the workflow.
7+
8+
9+
Code Style
10+
----------
11+
12+
* `PEP-8 <https://www.python.org/dev/peps/pep-0008>`_
13+
* `flake8 <https://pypi.python.org/pypi/flake8>`_ for quality checks
14+
* `invoke <http://www.pyinvoke.org/>`_ to automate development tasks
15+
16+
17+
Branches
18+
--------
19+
20+
We have two long term branches:
21+
22+
* ``master``: contains the code for the next bugfix release.
23+
* ``features``: contains the code with new features for the next minor release.
24+
25+
The official repository usually does not contain topic branches, developers and contributors should create topic
26+
branches in their own forks.
27+
28+
Exceptions can be made for cases where more than one contributor is working on the same
29+
topic or where it makes sense to use some automatic capability of the main repository, such as automatic docs from
30+
`readthedocs <readthedocs.org>`_ for a branch dealing with documentation refactoring.
31+
32+
Issues
33+
------
34+
35+
Any question, feature, bug or proposal is welcome as an issue. Users are encouraged to use them whenever they need.
36+
37+
GitHub issues should use labels to categorize them. Labels should be created sporadically, to fill a niche; we should
38+
avoid creating labels just for the sake of creating them.
39+
40+
Here is a list of labels and a brief description mentioning their intent.
41+
42+
43+
**Type**
44+
45+
* ``type: backward compatibility``: issue that will cause problems with old pytest versions.
46+
* ``type: bug``: problem that needs to be addressed.
47+
* ``type: deprecation``: feature that will be deprecated in the future.
48+
* ``type: docs``: documentation missing or needing clarification.
49+
* ``type: enhancement``: new feature or API change, should be merged into ``features``.
50+
* ``type: feature-branch``: new feature or API change, should be merged into ``features``.
51+
* ``type: infrastructure``: improvement to development/releases/CI structure.
52+
* ``type: performance``: performance or memory problem/improvement.
53+
* ``type: proposal``: proposal for a new feature, often to gather opinions or design the API around the new feature.
54+
* ``type: question``: question regarding usage, installation, internals or how to test something.
55+
* ``type: refactoring``: internal improvements to the code.
56+
* ``type: regression``: indicates a problem that was introduced in a release which was working previously.
57+
58+
**Status**
59+
60+
* ``status: critical``: grave problem or usability issue that affects lots of users.
61+
* ``status: easy``: easy issue that is friendly to new contributors.
62+
* ``status: help wanted``: core developers need help from experts on this topic.
63+
* ``status: needs information``: reporter needs to provide more information; can be closed after 2 or more weeks of inactivity.
64+
65+
**Topic**
66+
67+
* ``topic: collection``
68+
* ``topic: fixtures``
69+
* ``topic: parametrize``
70+
* ``topic: reporting``
71+
* ``topic: selection``
72+
* ``topic: tracebacks``
73+
74+
**Plugin (internal or external)**
75+
76+
* ``plugin: cache``
77+
* ``plugin: capture``
78+
* ``plugin: doctests``
79+
* ``plugin: junitxml``
80+
* ``plugin: monkeypatch``
81+
* ``plugin: nose``
82+
* ``plugin: pastebin``
83+
* ``plugin: pytester``
84+
* ``plugin: tmpdir``
85+
* ``plugin: unittest``
86+
* ``plugin: warnings``
87+
* ``plugin: xdist``
88+
89+
90+
**OS**
91+
92+
Issues specific to a single operating system. Do not use as a means to indicate where an issue originated from, only
93+
for problems that happen **only** in that system.
94+
95+
* ``os: linux``
96+
* ``os: mac``
97+
* ``os: windows``
98+
99+
**Temporary**
100+
101+
Used to classify issues for limited time, to help find issues related in events for example.
102+
They should be removed after they are no longer relevant.
103+
104+
* ``temporary: EP2017 sprint``:
105+
* ``temporary: sprint-candidate``:
106+
107+
108+
.. include:: ../../HOWTORELEASE.rst

doc/en/example/markers.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ The output is as follows::
435435
.
436436
1 passed in 0.12 seconds
437437

438-
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``.
438+
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``.
439439

440440

441441
Reading markers which were set from multiple places

doc/en/parametrize.rst

+4
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ list::
198198
SKIP [1] test_strings.py:2: got empty parameter set ['stringinput'], function test_valid_string at $REGENDOC_TMPDIR/test_strings.py:1
199199
1 skipped in 0.12 seconds
200200

201+
202+
Note that when calling ``metafunc.parametrize`` multiple times with different parameter sets, all parameter names across
203+
those sets cannot be duplicated, otherwise an error will be raised.
204+
201205
For further examples, you might want to look at :ref:`more
202206
parametrization examples <paramexamples>`.
203207

doc/en/skipping.rst

+11-7
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ by calling the ``pytest.skip(reason)`` function:
5454
if not valid_config():
5555
pytest.skip("unsupported configuration")
5656
57-
The imperative method is useful when it is not possible to evaluate the skip condition
57+
The imperative method is useful when it is not possible to evaluate the skip condition
5858
during import time.
5959

6060
``skipif``
@@ -73,7 +73,7 @@ when run on a Python3.3 interpreter::
7373
...
7474

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

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

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

121+
.. warning::
122+
123+
The use of ``skipif`` on classes that use inheritance is strongly
124+
discouraged. `A Known bug <https://github.com/pytest-dev/pytest/issues/568>`_
125+
in pytest's markers may cause unexpected behavior in super classes.
126+
121127
If you want to skip all test functions of a module, you may use
122128
the ``pytestmark`` name on the global level:
123129

@@ -305,12 +311,12 @@ Running it with the report-on-xfail option gives this output::
305311
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
306312
rootdir: $REGENDOC_TMPDIR/example, inifile:
307313
collected 7 items
308-
314+
309315
xfail_demo.py xxxxxxx
310316
======= short test summary info ========
311317
XFAIL xfail_demo.py::test_hello
312318
XFAIL xfail_demo.py::test_hello2
313-
reason: [NOTRUN]
319+
reason: [NOTRUN]
314320
XFAIL xfail_demo.py::test_hello3
315321
condition: hasattr(os, 'sep')
316322
XFAIL xfail_demo.py::test_hello4
@@ -320,7 +326,7 @@ Running it with the report-on-xfail option gives this output::
320326
XFAIL xfail_demo.py::test_hello6
321327
reason: reason
322328
XFAIL xfail_demo.py::test_hello7
323-
329+
324330
======= 7 xfailed in 0.12 seconds ========
325331

326332
.. _`skip/xfail with parametrize`:
@@ -346,5 +352,3 @@ test instances when using parametrize:
346352
])
347353
def test_increment(n, expected):
348354
assert n + 1 == expected
349-
350-

testing/code/test_source.py

-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ def g():
391391
assert lines == ['', 'def f():', ' def g():', ' pass', ' ']
392392

393393

394-
@pytest.mark.xfail("sys.version_info[:3] < (2,7,0)")
395394
def test_source_of_class_at_eof_without_newline(tmpdir):
396395
# this test fails because the implicit inspect.getsource(A) below
397396
# does not return the "x = 1" last line.

testing/python/collect.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ def test_customized_pymakeitem(self, testdir):
841841
def pytest_pycollect_makeitem():
842842
outcome = yield
843843
if outcome.excinfo is None:
844-
result = outcome.result
844+
result = outcome.get_result()
845845
if result:
846846
for func in result:
847847
func._some123 = "world"

testing/test_argcomplete.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def test_compare_with_compgen(self):
8282
from _pytest._argcomplete import FastFilesCompleter
8383
ffc = FastFilesCompleter()
8484
fc = FilesCompleter()
85-
for x in '/ /d /data qqq'.split():
85+
for x in ['/', '/d', '/data', 'qqq', '']:
8686
assert equal_with_bash(x, ffc, fc, out=py.std.sys.stdout)
8787

8888
@pytest.mark.skipif("sys.platform in ('win32', 'darwin')")

testing/test_mark.py

+12
Original file line numberDiff line numberDiff line change
@@ -812,3 +812,15 @@ def fake_method(self):
812812
assert fake_method.fun
813813
# pristine marks dont transfer
814814
assert fake_method.pytestmark == [pytest.mark.fun.mark]
815+
816+
817+
class TestMarkDecorator(object):
818+
819+
@pytest.mark.parametrize('lhs, rhs, expected', [
820+
(pytest.mark.foo(), pytest.mark.foo(), True),
821+
(pytest.mark.foo(), pytest.mark.bar(), False),
822+
(pytest.mark.foo(), 'bar', False),
823+
('foo', pytest.mark.bar(), False)
824+
])
825+
def test__eq__(self, lhs, rhs, expected):
826+
assert (lhs == rhs) == expected

0 commit comments

Comments
 (0)