Merge remote-tracking branch 'upstream/master' into features
This commit is contained in:
commit
3d89905114
1
AUTHORS
1
AUTHORS
|
@ -120,6 +120,7 @@ Michael Birtwell
|
|||
Michael Droettboom
|
||||
Michael Seifert
|
||||
Michal Wajszczuk
|
||||
Mihai Capotă
|
||||
Mike Lundy
|
||||
Nathaniel Waisbrot
|
||||
Ned Batchelder
|
||||
|
|
|
@ -34,13 +34,13 @@ If you are reporting a bug, please include:
|
|||
|
||||
* Your operating system name and version.
|
||||
* Any details about your local setup that might be helpful in troubleshooting,
|
||||
specifically Python interpreter version,
|
||||
installed libraries and pytest version.
|
||||
specifically the Python interpreter version, installed libraries, and pytest
|
||||
version.
|
||||
* Detailed steps to reproduce the bug.
|
||||
|
||||
If you can write a demonstration test that currently fails but should pass (xfail),
|
||||
that is a very useful commit to make as well, even if you can't find how
|
||||
to fix the bug yet.
|
||||
If you can write a demonstration test that currently fails but should pass
|
||||
(xfail), that is a very useful commit to make as well, even if you cannot
|
||||
fix the bug itself.
|
||||
|
||||
|
||||
.. _fixbugs:
|
||||
|
@ -165,29 +165,30 @@ Short version
|
|||
~~~~~~~~~~~~~
|
||||
|
||||
#. Fork the repository;
|
||||
#. Target ``master`` for bug-fix and doc changes;
|
||||
#. Target ``master`` for bugfixes and doc changes;
|
||||
#. Target ``features`` for new features or functionality changes.
|
||||
#. Follow **PEP-8**. There's a ``tox`` command to help fixing it: ``tox -e fix-lint``.
|
||||
#. Tests are run using ``tox``::
|
||||
|
||||
tox -e linting,py27,py36
|
||||
|
||||
The test environments above are usually enough to to cover most cases locally.
|
||||
The test environments above are usually enough to cover most cases locally.
|
||||
|
||||
#. Write a ``changelog`` entry: ``changelog/2574.bugfix``, use issue id number and one of
|
||||
``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or ``trivial`` for the issue type.
|
||||
#. Write a ``changelog`` entry: ``changelog/2574.bugfix``, use issue id number
|
||||
and one of ``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or
|
||||
``trivial`` for the issue type.
|
||||
#. Add yourself to ``AUTHORS`` file if not there yet, in alphabetical order.
|
||||
|
||||
|
||||
Long version
|
||||
~~~~~~~~~~~~
|
||||
|
||||
|
||||
What is a "pull request"? It informs project's core developers about the
|
||||
What is a "pull request"? It informs the project's core developers about the
|
||||
changes you want to review and merge. Pull requests are stored on
|
||||
`GitHub servers <https://github.com/pytest-dev/pytest/pulls>`_.
|
||||
Once you send a pull request, we can discuss its potential modifications and
|
||||
even add more commits to it later on. There's an excellent tutorial on how Pull Requests work in the
|
||||
even add more commits to it later on. There's an excellent tutorial on how Pull
|
||||
Requests work in the
|
||||
`GitHub Help Center <https://help.github.com/articles/using-pull-requests/>`_.
|
||||
|
||||
Here is a simple overview, with pytest-specific bits:
|
||||
|
|
|
@ -254,6 +254,11 @@ class EncodedFile(object):
|
|||
data = ''.join(linelist)
|
||||
self.write(data)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Ensure that file.name is a string."""
|
||||
return repr(self.buffer)
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(object.__getattribute__(self, "buffer"), name)
|
||||
|
||||
|
|
|
@ -916,8 +916,11 @@ class Testdir:
|
|||
env['PYTHONPATH'] = os.pathsep.join(filter(None, [
|
||||
str(os.getcwd()), env.get('PYTHONPATH', '')]))
|
||||
kw['env'] = env
|
||||
return subprocess.Popen(cmdargs,
|
||||
stdout=stdout, stderr=stderr, **kw)
|
||||
|
||||
popen = subprocess.Popen(cmdargs, stdin=subprocess.PIPE, stdout=stdout, stderr=stderr, **kw)
|
||||
popen.stdin.close()
|
||||
|
||||
return popen
|
||||
|
||||
def run(self, *cmdargs):
|
||||
"""Run a command with arguments.
|
||||
|
|
|
@ -425,9 +425,10 @@ class Module(main.File, PyCollector):
|
|||
if e.allow_module_level:
|
||||
raise
|
||||
raise self.CollectError(
|
||||
"Using pytest.skip outside of a test is not allowed. If you are "
|
||||
"trying to decorate a test function, use the @pytest.mark.skip "
|
||||
"or @pytest.mark.skipif decorators instead."
|
||||
"Using pytest.skip outside of a test is not allowed. "
|
||||
"To decorate a test function, use the @pytest.mark.skip "
|
||||
"or @pytest.mark.skipif decorators instead, and to skip a "
|
||||
"module use `pytestmark = pytest.mark.{skip,skipif}."
|
||||
)
|
||||
self.config.pluginmanager.consider_module(mod)
|
||||
return mod
|
||||
|
|
|
@ -382,4 +382,4 @@ def show_skipped(terminalreporter, lines):
|
|||
reason = reason[9:]
|
||||
lines.append(
|
||||
"SKIP [%d] %s:%d: %s" %
|
||||
(num, fspath, lineno, reason))
|
||||
(num, fspath, lineno + 1, reason))
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Set ``stdin`` to a closed ``PIPE`` in ``pytester.py.Testdir.popen()`` for avoid unwanted interactive ``pdb``
|
|
@ -0,0 +1 @@
|
|||
Improve error message for CollectError with skip/skipif.
|
|
@ -0,0 +1 @@
|
|||
Fix line number when reporting summary of skipped tests.
|
|
@ -0,0 +1 @@
|
|||
capture: ensure that EncodedFile.name is a string.
|
|
@ -0,0 +1 @@
|
|||
Show multiple issue links in CHANGELOG entries.
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
{% if definitions[category]['showcontent'] %}
|
||||
{% for text, values in sections[section][category]|dictsort(by='value') %}
|
||||
- {{ text }}{% if category != 'vendor' %} (`{{ values[0] }} <https://github.com/pytest-dev/pytest/issues/{{ values[0][1:] }}>`_){% endif %}
|
||||
{% set issue_joiner = joiner(', ') %}
|
||||
- {{ text }}{% if category != 'vendor' %} ({% for value in values|sort %}{{ issue_joiner() }}`{{ value }} <https://github.com/pytest-dev/pytest/issues/{{ value[1:] }}>`_{% endfor %}){% endif %}
|
||||
|
||||
|
||||
{% endfor %}
|
||||
|
|
|
@ -716,13 +716,21 @@ def test_dupfile(tmpfile):
|
|||
assert nf not in flist
|
||||
print(i, end="", file=nf)
|
||||
flist.append(nf)
|
||||
|
||||
fname_open = flist[0].name
|
||||
assert fname_open == repr(flist[0].buffer)
|
||||
|
||||
for i in range(5):
|
||||
f = flist[i]
|
||||
f.close()
|
||||
fname_closed = flist[0].name
|
||||
assert fname_closed == repr(flist[0].buffer)
|
||||
assert fname_closed != fname_open
|
||||
tmpfile.seek(0)
|
||||
s = tmpfile.read()
|
||||
assert "01234" in repr(s)
|
||||
tmpfile.close()
|
||||
assert fname_closed == repr(flist[0].buffer)
|
||||
|
||||
|
||||
def test_dupfile_on_bytesio():
|
||||
|
@ -730,6 +738,7 @@ def test_dupfile_on_bytesio():
|
|||
f = capture.safe_text_dupfile(io, "wb")
|
||||
f.write("hello")
|
||||
assert io.getvalue() == b"hello"
|
||||
assert 'BytesIO object' in f.name
|
||||
|
||||
|
||||
def test_dupfile_on_textio():
|
||||
|
@ -737,6 +746,7 @@ def test_dupfile_on_textio():
|
|||
f = capture.safe_text_dupfile(io, "wb")
|
||||
f.write("hello")
|
||||
assert io.getvalue() == "hello"
|
||||
assert not hasattr(f, 'name')
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
|
|
@ -708,7 +708,7 @@ def test_skipped_reasons_functional(testdir):
|
|||
)
|
||||
result = testdir.runpytest('-rs')
|
||||
result.stdout.fnmatch_lines([
|
||||
"*SKIP*2*conftest.py:3: test",
|
||||
"*SKIP*2*conftest.py:4: test",
|
||||
])
|
||||
assert result.ret == 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue