Skip to content

Commit

Permalink
Merge branch 'my-master' into revert
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Feb 13, 2020
2 parents b0d6aca + f04c5ca commit 338c7ba
Show file tree
Hide file tree
Showing 28 changed files with 394 additions and 253 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ on:
push:
branches:
- my-master
- "[0-9]+.[0-9]+.x"
tags:
- "*"
pull_request:
branches:
- my-master
- "[0-9]+.[0-9]+.x"

jobs:
tests:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
"mypy-diff",
]

include:
- name: "mypy-diff"
python: "3.8"
os: ubuntu-latest
tox_env: "mypy-diff"
# include:
# - name: "mypy-diff"
# python: "3.8"
# os: ubuntu-latest
# tox_env: "mypy-diff"

steps:
- uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ repos:
- id: rst
name: rst
entry: rst-lint --encoding utf-8
files: ^(HOWTORELEASE.rst|README.rst|TIDELIFT.rst)$
files: ^(RELEASING.rst|README.rst|TIDELIFT.rst)$
language: python
additional_dependencies: [pygments, restructuredtext_lint]
- id: changelogs-rst
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ script:
branches:
only:
- my-master
- /^\d+\.\d+\.x$/
11 changes: 2 additions & 9 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ Short version

#. Fork the repository.
#. Enable and install `pre-commit <https://pre-commit.com>`_ to ensure style-guides and code checks are followed.
#. Target ``master`` for bug fixes and doc changes.
#. Target ``features`` for new features or functionality changes.
#. Follow **PEP-8** for naming and `black <https://github.com/psf/black>`_ for formatting.
#. Tests are run using ``tox``::

Expand Down Expand Up @@ -204,14 +202,10 @@ Here is a simple overview, with pytest-specific bits:

$ git clone [email protected]:YOUR_GITHUB_USERNAME/pytest.git
$ cd pytest
# now, to fix a bug create your own branch off "master":
# now, create your own branch off "master":

$ git checkout -b your-bugfix-branch-name master

# or to instead add a feature create your own branch off "features":

$ git checkout -b your-feature-branch-name features

Given we have "major.minor.micro" version numbers, bug fixes will usually
be released in micro releases whereas features will be released in
minor releases and incompatible changes in major releases.
Expand Down Expand Up @@ -294,8 +288,7 @@ Here is a simple overview, with pytest-specific bits:
compare: your-branch-name

base-fork: pytest-dev/pytest
base: master # if it's a bug fix
base: features # if it's a feature
base: master


Writing Tests
Expand Down
30 changes: 14 additions & 16 deletions HOWTORELEASE.rst → RELEASING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,38 @@ taking a lot of time to make a new one.
pytest releases must be prepared on **Linux** because the docs and examples expect
to be executed on that platform.

#. Create a branch ``release-X.Y.Z`` with the version for the release.
To release a version ``MAJOR.MINOR.PATCH``, follow these steps:

* **maintenance releases**: from ``4.6-maintenance``;
#. For major and minor releases, create a new branch ``MAJOR.MINOR.x`` from the
latest ``master`` and push it to the ``pytest-dev/pytest`` repo.

* **patch releases**: from the latest ``master``;
#. Create a branch ``release-MAJOR.MINOR.PATCH`` from the ``MAJOR.MINOR.x`` branch.

* **minor releases**: from the latest ``features``; then merge with the latest ``master``;

Ensure your are in a clean work tree.
Ensure your are updated and in a clean working tree.

#. Using ``tox``, generate docs, changelog, announcements::

$ tox -e release -- <VERSION>
$ tox -e release -- MAJOR.MINOR.PATCH

This will generate a commit with all the changes ready for pushing.

#. Open a PR for this branch targeting ``master`` (or ``4.6-maintenance`` for
maintenance releases).
#. Open a PR for the ``release-MAJOR.MINOR.PATCH`` branch targeting ``MAJOR.MINOR.x``.

#. After all tests pass and the PR has been approved, publish to PyPI by pushing the tag::
#. After all tests pass and the PR has been approved, tag the release commit
in the ``MAJOR.MINOR.x`` branch and push it. This will publish to PyPI::

git tag <VERSION>
git push [email protected]:pytest-dev/pytest.git <VERSION>
git tag MAJOR.MINOR.PATCH
git push [email protected]:pytest-dev/pytest.git MAJOR.MINOR.PATCH

Wait for the deploy to complete, then make sure it is `available on PyPI <https://pypi.org/project/pytest>`_.

#. Merge the PR.

#. If this is a maintenance release, cherry-pick the CHANGELOG / announce
files to the ``master`` branch::
#. Cherry-pick the CHANGELOG / announce files to the ``master`` branch::

git fetch --all --prune
git checkout origin/master -b cherry-pick-maintenance-release
git cherry-pick --no-commit -m1 origin/4.6-maintenance
git checkout origin/master -b cherry-pick-release
git cherry-pick --no-commit -m1 origin/MAJOR.MINOR.x
git checkout origin/master -- changelog
git commit # no arguments

Expand Down
1 change: 0 additions & 1 deletion changelog/6003.improvement.rst

This file was deleted.

3 changes: 3 additions & 0 deletions changelog/6575.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix internal crash when ``faulthandler`` starts initialized
(for example with ``PYTHONFAULTHANDLER=1`` environment variable set) and ``faulthandler_timeout`` defined
in the configuration file.
2 changes: 1 addition & 1 deletion doc/en/development_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ Issues created at those events should have other relevant labels added as well.
Those labels should be removed after they are no longer relevant.


.. include:: ../../HOWTORELEASE.rst
.. include:: ../../RELEASING.rst
10 changes: 5 additions & 5 deletions doc/en/py27-py34-deprecation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ Maintenance of 4.6.X versions
-----------------------------

Until January 2020, the pytest core team ported many bug-fixes from the main release into the
``4.6-maintenance`` branch, with several 4.6.X releases being made along the year.
``4.6.x`` branch, with several 4.6.X releases being made along the year.

From now on, the core team will **no longer actively backport patches**, but the ``4.6-maintenance``
From now on, the core team will **no longer actively backport patches**, but the ``4.6.x``
branch will continue to exist so the community itself can contribute patches.

The core team will be happy to accept those patches, and make new 4.6.X releases **until mid-2020**
Expand Down Expand Up @@ -74,22 +74,22 @@ Please follow these instructions:

#. ``git fetch --all --prune``

#. ``git checkout origin/4.6-maintenance -b backport-XXXX`` # use the PR number here
#. ``git checkout origin/4.6.x -b backport-XXXX`` # use the PR number here

#. Locate the merge commit on the PR, in the *merged* message, for example:

nicoddemus merged commit 0f8b462 into pytest-dev:features

#. ``git cherry-pick -m1 REVISION`` # use the revision you found above (``0f8b462``).

#. Open a PR targeting ``4.6-maintenance``:
#. Open a PR targeting ``4.6.x``:

* Prefix the message with ``[4.6]`` so it is an obvious backport
* Delete the PR body, it usually contains a duplicate commit message.

**Providing new PRs to 4.6**

Fresh pull requests to ``4.6-maintenance`` will be accepted provided that
Fresh pull requests to ``4.6.x`` will be accepted provided that
the equivalent code in the active branches does not contain that bug (for example, a bug is specific
to Python 2 only).

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
INSTALL_REQUIRES = [
"py>=1.5.0",
"packaging",
"attrs>=19.2.0", # should match oldattrs tox env, bumped for kw_only.
"attrs>=17.4.0", # should match oldattrs tox env.
"more-itertools>=4.0.0",
'atomicwrites>=1.0;sys_platform=="win32"',
'pathlib2>=2.2.0;python_version<"3.6"',
Expand Down
10 changes: 4 additions & 6 deletions src/_pytest/_code/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,7 @@ def _getreprcrash(self) -> "ReprFileLocation":
exconly = self.exconly(tryshort=True)
entry = self.traceback.getcrashentry()
path, lineno = entry.frame.code.raw.co_filename, entry.lineno
short_msg = getattr(self.value, "short_msg", None)
return ReprFileLocation(path, lineno + 1, exconly, short_msg=short_msg)
return ReprFileLocation(path, lineno + 1, exconly)

def getrepr(
self,
Expand Down Expand Up @@ -808,8 +807,10 @@ def repr_traceback_entry(
lines.extend(s)
if short:
message = "in %s" % (entry.name)
elif excinfo:
message = excinfo.exconly(tryshort=True)
else:
message = excinfo and excinfo.typename or ""
message = ""
path = self._makepath(entry.path)
filelocrepr = ReprFileLocation(str(path), entry.lineno + 1, message)
localsrepr = None
Expand Down Expand Up @@ -1110,14 +1111,11 @@ class ReprFileLocation(TerminalRepr):
path = attr.ib(type=str)
lineno = attr.ib(type=int)
message = attr.ib(type=str)
short_msg = attr.ib(type=Optional[str], default=None, kw_only=True)

def __attrs_post_init__(self):
assert type(self.path) == str

def _get_short_msg(self) -> str:
if self.short_msg:
return self.short_msg
msg = self.message
i = msg.find("\n")
if i != -1:
Expand Down
40 changes: 30 additions & 10 deletions src/_pytest/assertion/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ def assertrepr_compare(config, op: str, left: Any, right: Any) -> Optional[List[
raise
except Exception:
explanation = [
"(pytest_assertion plugin: representation of details failed. "
"Probably an object has a faulty __repr__.)",
str(_pytest._code.ExceptionInfo.from_current()),
"(pytest_assertion plugin: representation of details failed: {}.".format(
_pytest._code.ExceptionInfo.from_current()._getreprcrash()
),
" Probably an object has a faulty __repr__.)",
]

if not explanation:
Expand All @@ -194,6 +195,7 @@ def _diff_text(left: str, right: str, verbose: int = 0) -> List[str]:
characters which are identical to keep the diff minimal.
"""
from difflib import ndiff
from wcwidth import wcswidth

explanation = [] # type: List[str]

Expand Down Expand Up @@ -226,10 +228,18 @@ def _diff_text(left: str, right: str, verbose: int = 0) -> List[str]:
left = repr(str(left))
right = repr(str(right))
explanation += ["Strings contain only whitespace, escaping them using repr()"]
explanation += [
line.strip("\n")
for line in ndiff(left.splitlines(keepends), right.splitlines(keepends))
]

left_lines = left.splitlines(keepends)
right_lines = right.splitlines(keepends)

if any(wcswidth(x) == -1 for x in left_lines + right_lines):
left_lines = [repr(x) for x in left_lines]
right_lines = [repr(x) for x in right_lines]
explanation += [
"Strings contain non-printable/escape characters, escaping them using repr()"
]

explanation += [line.strip("\n") for line in ndiff(left_lines, right_lines)]
return explanation


Expand Down Expand Up @@ -313,9 +323,19 @@ def _compare_eq_sequence(
left_value = left[i]
right_value = right[i]

explanation += [
"At index {} diff: {!r} != {!r}".format(i, left_value, right_value)
]
left_repr = repr(left_value)
right_repr = repr(right_value)
gets_full_diff = verbose > 0 # via _compare_eq_iterable later.
if not gets_full_diff and len(left_repr) > 10 and len(right_repr) > 10:
explanation += [
"At index {} diff:".format(i),
"{} !=".format(left_repr),
"{}".format(right_repr),
]
else:
explanation += [
"At index {} diff: {} != {}".format(i, left_repr, right_repr)
]
break

if comparing_bytes:
Expand Down
Loading

0 comments on commit 338c7ba

Please sign in to comment.