diff --git a/AUTHORS b/AUTHORS index ec04f98b9..77b0e4835 100644 --- a/AUTHORS +++ b/AUTHORS @@ -333,5 +333,6 @@ Xuan Luong Xuecong Liao Yoav Caspi Zac Hatfield-Dodds +Zachary Kneupper Zoltán Máté Zsolt Cserna diff --git a/scripts/release.py b/scripts/release.py index 798e42e1f..6892a0758 100644 --- a/scripts/release.py +++ b/scripts/release.py @@ -100,10 +100,7 @@ def pre_release(version, *, skip_check_links): def changelog(version, write_out=False): - if write_out: - addopts = [] - else: - addopts = ["--draft"] + addopts = [] if write_out else ["--draft"] check_call(["towncrier", "--yes", "--version", version] + addopts) diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index 9e2d3fa62..34123718c 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -618,14 +618,8 @@ class MultiCapture(Generic[AnyStr]): return self._state == "started" def readouterr(self) -> CaptureResult[AnyStr]: - if self.out: - out = self.out.snap() - else: - out = "" - if self.err: - err = self.err.snap() - else: - err = "" + out = self.out.snap() if self.out else "" + err = self.err.snap() if self.err else "" return CaptureResult(out, err) diff --git a/src/_pytest/doctest.py b/src/_pytest/doctest.py index cba11a44f..e2cca3791 100644 --- a/src/_pytest/doctest.py +++ b/src/_pytest/doctest.py @@ -647,10 +647,7 @@ def _init_checker_class() -> Type["doctest.OutputChecker"]: exponent: Optional[str] = w.group("exponent1") if exponent is None: exponent = w.group("exponent2") - if fraction is None: - precision = 0 - else: - precision = len(fraction) + precision = 0 if fraction is None else len(fraction) if exponent is not None: precision -= int(exponent) if float(w.group()) == approx(float(g.group()), abs=10 ** -precision): diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index 01d378abc..a8dd0fc6a 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -669,10 +669,7 @@ class TerminalReporter: skipped = len(self.stats.get("skipped", [])) deselected = len(self.stats.get("deselected", [])) selected = self._numcollected - errors - skipped - deselected - if final: - line = "collected " - else: - line = "collecting " + line = "collected " if final else "collecting " line += ( str(self._numcollected) + " item" + ("" if self._numcollected == 1 else "s") ) diff --git a/src/_pytest/threadexception.py b/src/_pytest/threadexception.py index b250a5234..43341e739 100644 --- a/src/_pytest/threadexception.py +++ b/src/_pytest/threadexception.py @@ -61,10 +61,7 @@ def thread_exception_runtest_hook() -> Generator[None, None, None]: with catch_threading_exception() as cm: yield if cm.args: - if cm.args.thread is not None: - thread_name = cm.args.thread.name - else: - thread_name = "" + thread_name = "" if cm.args.thread is None else cm.args.thread.name msg = f"Exception in thread {thread_name}\n\n" msg += "".join( traceback.format_exception(