Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pytest for openSUSE:Factory checked in at 2021-05-18 18:26:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest (Old) and /work/SRC/openSUSE:Factory/.python-pytest.new.2988 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest" Tue May 18 18:26:33 2021 rev:65 rq:893085 version:6.2.4 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest/python-pytest.changes 2021-02-16 22:34:25.677492031 +0100 +++ /work/SRC/openSUSE:Factory/.python-pytest.new.2988/python-pytest.changes 2021-05-18 18:26:44.378885122 +0200 @@ -1,0 +2,11 @@ +Fri May 14 10:04:36 UTC 2021 - Mark??ta Machov?? <[email protected]> + +- Update to 6.2.4 + * pytest used to create directories under /tmp with world-readable + permissions. This means that any user in the system was able to + read information written by tests in temporary directories (such + as those created by the tmp_path/tmpdir fixture). Now the + directories are created with private permissions. + * Fixed assertion rewriting on Python 3.10. + +------------------------------------------------------------------- Old: ---- pytest-6.2.2.tar.gz New: ---- pytest-6.2.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest.spec ++++++ --- /var/tmp/diff_new_pack.LMefhK/_old 2021-05-18 18:26:44.826883180 +0200 +++ /var/tmp/diff_new_pack.LMefhK/_new 2021-05-18 18:26:44.830883163 +0200 @@ -1,5 +1,5 @@ # -# spec file for package python +# spec file for package python-pytest%{psuffix} # # Copyright (c) 2021 SUSE LLC # @@ -27,7 +27,7 @@ %endif %define skip_python2 1 Name: python-pytest%{psuffix} -Version: 6.2.2 +Version: 6.2.4 Release: 0 Summary: Simple powerful testing with Python License: MIT @@ -48,7 +48,7 @@ Requires: python-toml Requires: python-wcwidth Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives Obsoletes: python-pytest-doc BuildArch: noarch %if %{with test} ++++++ pytest-6.2.2.tar.gz -> pytest-6.2.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/AUTHORS new/pytest-6.2.4/AUTHORS --- old/pytest-6.2.2/AUTHORS 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/AUTHORS 2021-05-04 18:21:46.000000000 +0200 @@ -273,6 +273,7 @@ Segev Finer Serhii Mozghovyi Seth Junot +Shantanu Jain Shubham Adep Simon Gomizelj Simon Kerr diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/PKG-INFO new/pytest-6.2.4/PKG-INFO --- old/pytest-6.2.2/PKG-INFO 2021-01-25 15:51:34.000000000 +0100 +++ new/pytest-6.2.4/PKG-INFO 2021-05-04 18:21:54.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pytest -Version: 6.2.2 +Version: 6.2.4 Summary: pytest: simple powerful testing with Python Home-page: https://docs.pytest.org/en/latest/ Author: Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/doc/en/announce/index.rst new/pytest-6.2.4/doc/en/announce/index.rst --- old/pytest-6.2.2/doc/en/announce/index.rst 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/doc/en/announce/index.rst 2021-05-04 18:21:46.000000000 +0200 @@ -6,6 +6,8 @@ :maxdepth: 2 + release-6.2.4 + release-6.2.3 release-6.2.2 release-6.2.1 release-6.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/doc/en/announce/release-6.2.3.rst new/pytest-6.2.4/doc/en/announce/release-6.2.3.rst --- old/pytest-6.2.2/doc/en/announce/release-6.2.3.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-6.2.4/doc/en/announce/release-6.2.3.rst 2021-05-04 18:21:46.000000000 +0200 @@ -0,0 +1,19 @@ +pytest-6.2.3 +======================================= + +pytest 6.2.3 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at https://docs.pytest.org/en/stable/changelog.html. + +Thanks to all of the contributors to this release: + +* Bruno Oliveira +* Ran Benita + + +Happy testing, +The pytest Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/doc/en/announce/release-6.2.4.rst new/pytest-6.2.4/doc/en/announce/release-6.2.4.rst --- old/pytest-6.2.2/doc/en/announce/release-6.2.4.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pytest-6.2.4/doc/en/announce/release-6.2.4.rst 2021-05-04 18:21:46.000000000 +0200 @@ -0,0 +1,22 @@ +pytest-6.2.4 +======================================= + +pytest 6.2.4 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at https://docs.pytest.org/en/stable/changelog.html. + +Thanks to all of the contributors to this release: + +* Anthony Sottile +* Bruno Oliveira +* Christian Maurer +* Florian Bruhin +* Ran Benita + + +Happy testing, +The pytest Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/doc/en/changelog.rst new/pytest-6.2.4/doc/en/changelog.rst --- old/pytest-6.2.2/doc/en/changelog.rst 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/doc/en/changelog.rst 2021-05-04 18:21:46.000000000 +0200 @@ -28,6 +28,33 @@ .. towncrier release notes start +pytest 6.2.4 (2021-05-04) +========================= + +Bug Fixes +--------- + +- `#8539 <https://github.com/pytest-dev/pytest/issues/8539>`_: Fixed assertion rewriting on Python 3.10. + + +pytest 6.2.3 (2021-04-03) +========================= + +Bug Fixes +--------- + +- `#8414 <https://github.com/pytest-dev/pytest/issues/8414>`_: pytest used to create directories under ``/tmp`` with world-readable + permissions. This means that any user in the system was able to read + information written by tests in temporary directories (such as those created by + the ``tmp_path``/``tmpdir`` fixture). Now the directories are created with + private permissions. + + pytest used silenty use a pre-existing ``/tmp/pytest-of-<username>`` directory, + even if owned by another user. This means another user could pre-create such a + directory and gain control of another user's temporary directory. Now such a + condition results in an error. + + pytest 6.2.2 (2021-01-25) ========================= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/doc/en/example/parametrize.rst new/pytest-6.2.4/doc/en/example/parametrize.rst --- old/pytest-6.2.2/doc/en/example/parametrize.rst 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/doc/en/example/parametrize.rst 2021-05-04 18:21:46.000000000 +0200 @@ -508,11 +508,12 @@ .. code-block:: pytest . $ pytest -rs -q multipython.py - ssssssssssss...ssssssssssss [100%] + sssssssssssssssssssssssssss [100%] ========================= short test summary info ========================== - SKIPPED [12] multipython.py:29: 'python3.5' not found - SKIPPED [12] multipython.py:29: 'python3.7' not found - 3 passed, 24 skipped in 0.12s + SKIPPED [9] multipython.py:29: 'python3.5' not found + SKIPPED [9] multipython.py:29: 'python3.6' not found + SKIPPED [9] multipython.py:29: 'python3.7' not found + 27 skipped in 0.12s Indirect parametrization of optional implementations/imports -------------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/doc/en/fixture.rst new/pytest-6.2.4/doc/en/fixture.rst --- old/pytest-6.2.2/doc/en/fixture.rst 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/doc/en/fixture.rst 2021-05-04 18:21:46.000000000 +0200 @@ -1124,7 +1124,7 @@ .. _`conftest.py`: .. _`conftest`: -Fixture availabiility +Fixture availability --------------------- Fixture availability is determined from the perspective of the test. A fixture diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/doc/en/getting-started.rst new/pytest-6.2.4/doc/en/getting-started.rst --- old/pytest-6.2.2/doc/en/getting-started.rst 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/doc/en/getting-started.rst 2021-05-04 18:21:46.000000000 +0200 @@ -28,7 +28,7 @@ .. code-block:: bash $ pytest --version - pytest 6.2.2 + pytest 6.2.4 .. _`simpletest`: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/doc/en/index.rst new/pytest-6.2.4/doc/en/index.rst --- old/pytest-6.2.2/doc/en/index.rst 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/doc/en/index.rst 2021-05-04 18:21:46.000000000 +0200 @@ -2,7 +2,7 @@ .. sidebar:: Next Open Trainings - - `Professional testing with Python <https://www.python-academy.com/courses/specialtopics/python_course_testing.html>`_, via Python Academy, February 1-3 2021, remote and Leipzig (Germany). **Early-bird discount available until January 15th**. + - `Professionelles Testen f??r Python mit pytest <https://www.enterpy.de/lecture_compact1.php?id=12713>`_ (German), part of the enterPy conference, April 22nd (sold out) and May 20th, remote. Also see `previous talks and blogposts <talks.html>`_. @@ -11,6 +11,7 @@ pytest: helps you write better programs ======================================= +.. module:: pytest The ``pytest`` framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/doc/en/reference.rst new/pytest-6.2.4/doc/en/reference.rst --- old/pytest-6.2.2/doc/en/reference.rst 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/doc/en/reference.rst 2021-05-04 18:21:46.000000000 +0200 @@ -3,8 +3,6 @@ API Reference ============= -.. module:: pytest - This page contains the full reference to pytest's API. .. contents:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/src/_pytest/_version.py new/pytest-6.2.4/src/_pytest/_version.py --- old/pytest-6.2.2/src/_pytest/_version.py 2021-01-25 15:51:33.000000000 +0100 +++ new/pytest-6.2.4/src/_pytest/_version.py 2021-05-04 18:21:54.000000000 +0200 @@ -1,5 +1,5 @@ # coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control -version = '6.2.2' -version_tuple = (6, 2, 2) +version = '6.2.4' +version_tuple = (6, 2, 4) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/src/_pytest/assertion/rewrite.py new/pytest-6.2.4/src/_pytest/assertion/rewrite.py --- old/pytest-6.2.2/src/_pytest/assertion/rewrite.py 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/src/_pytest/assertion/rewrite.py 2021-05-04 18:21:46.000000000 +0200 @@ -673,12 +673,9 @@ if not mod.body: # Nothing to do. return - # Insert some special imports at the top of the module but after any - # docstrings and __future__ imports. - aliases = [ - ast.alias("builtins", "@py_builtins"), - ast.alias("_pytest.assertion.rewrite", "@pytest_ar"), - ] + + # We'll insert some special imports at the top of the module, but after any + # docstrings and __future__ imports, so first figure out where that is. doc = getattr(mod, "docstring", None) expect_docstring = doc is None if doc is not None and self.is_rewrite_disabled(doc): @@ -710,10 +707,27 @@ lineno = item.decorator_list[0].lineno else: lineno = item.lineno + # Now actually insert the special imports. + if sys.version_info >= (3, 10): + aliases = [ + ast.alias("builtins", "@py_builtins", lineno=lineno, col_offset=0), + ast.alias( + "_pytest.assertion.rewrite", + "@pytest_ar", + lineno=lineno, + col_offset=0, + ), + ] + else: + aliases = [ + ast.alias("builtins", "@py_builtins"), + ast.alias("_pytest.assertion.rewrite", "@pytest_ar"), + ] imports = [ ast.Import([alias], lineno=lineno, col_offset=0) for alias in aliases ] mod.body[pos:pos] = imports + # Collect asserts. nodes: List[ast.AST] = [mod] while nodes: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/src/_pytest/pathlib.py new/pytest-6.2.4/src/_pytest/pathlib.py --- old/pytest-6.2.2/src/_pytest/pathlib.py 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/src/_pytest/pathlib.py 2021-05-04 18:21:46.000000000 +0200 @@ -64,13 +64,6 @@ return path.joinpath(".lock") -def ensure_reset_dir(path: Path) -> None: - """Ensure the given path is an empty directory.""" - if path.exists(): - rm_rf(path) - path.mkdir() - - def on_rm_rf_error(func, path: str, exc, *, start_path: Path) -> bool: """Handle known read-only errors during rmtree. @@ -214,7 +207,7 @@ pass -def make_numbered_dir(root: Path, prefix: str) -> Path: +def make_numbered_dir(root: Path, prefix: str, mode: int = 0o700) -> Path: """Create a directory with an increased number as suffix for the given prefix.""" for i in range(10): # try up to 10 times to create the folder @@ -222,7 +215,7 @@ new_number = max_existing + 1 new_path = root.joinpath(f"{prefix}{new_number}") try: - new_path.mkdir() + new_path.mkdir(mode=mode) except Exception: pass else: @@ -354,13 +347,13 @@ def make_numbered_dir_with_cleanup( - root: Path, prefix: str, keep: int, lock_timeout: float + root: Path, prefix: str, keep: int, lock_timeout: float, mode: int, ) -> Path: """Create a numbered dir with a cleanup lock and remove old ones.""" e = None for i in range(10): try: - p = make_numbered_dir(root, prefix) + p = make_numbered_dir(root, prefix, mode) lock_path = create_cleanup_lock(p) register_cleanup_lock_removal(lock_path) except Exception as exc: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/src/_pytest/pytester.py new/pytest-6.2.4/src/_pytest/pytester.py --- old/pytest-6.2.2/src/_pytest/pytester.py 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/src/_pytest/pytester.py 2021-05-04 18:21:46.000000000 +0200 @@ -1426,7 +1426,7 @@ :rtype: RunResult """ __tracebackhide__ = True - p = make_numbered_dir(root=self.path, prefix="runpytest-") + p = make_numbered_dir(root=self.path, prefix="runpytest-", mode=0o700) args = ("--basetemp=%s" % p,) + args plugins = [x for x in self.plugins if isinstance(x, str)] if plugins: @@ -1445,7 +1445,7 @@ The pexpect child is returned. """ basetemp = self.path / "temp-pexpect" - basetemp.mkdir() + basetemp.mkdir(mode=0o700) invoke = " ".join(map(str, self._getpytestargs())) cmd = f"{invoke} --basetemp={basetemp} {string}" return self.spawn(cmd, expect_timeout=expect_timeout) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/src/_pytest/tmpdir.py new/pytest-6.2.4/src/_pytest/tmpdir.py --- old/pytest-6.2.2/src/_pytest/tmpdir.py 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/src/_pytest/tmpdir.py 2021-05-04 18:21:46.000000000 +0200 @@ -8,10 +8,10 @@ import attr import py -from .pathlib import ensure_reset_dir from .pathlib import LOCK_TIMEOUT from .pathlib import make_numbered_dir from .pathlib import make_numbered_dir_with_cleanup +from .pathlib import rm_rf from _pytest.compat import final from _pytest.config import Config from _pytest.deprecated import check_ispytest @@ -90,20 +90,22 @@ basename = self._ensure_relative_to_basetemp(basename) if not numbered: p = self.getbasetemp().joinpath(basename) - p.mkdir() + p.mkdir(mode=0o700) else: - p = make_numbered_dir(root=self.getbasetemp(), prefix=basename) + p = make_numbered_dir(root=self.getbasetemp(), prefix=basename, mode=0o700) self._trace("mktemp", p) return p def getbasetemp(self) -> Path: - """Return base temporary directory.""" + """Return the base temporary directory, creating it if needed.""" if self._basetemp is not None: return self._basetemp if self._given_basetemp is not None: basetemp = self._given_basetemp - ensure_reset_dir(basetemp) + if basetemp.exists(): + rm_rf(basetemp) + basetemp.mkdir(mode=0o700) basetemp = basetemp.resolve() else: from_env = os.environ.get("PYTEST_DEBUG_TEMPROOT") @@ -112,14 +114,37 @@ # use a sub-directory in the temproot to speed-up # make_numbered_dir() call rootdir = temproot.joinpath(f"pytest-of-{user}") - rootdir.mkdir(exist_ok=True) + rootdir.mkdir(mode=0o700, exist_ok=True) + # Because we use exist_ok=True with a predictable name, make sure + # we are the owners, to prevent any funny business (on unix, where + # temproot is usually shared). + # Also, to keep things private, fixup any world-readable temp + # rootdir's permissions. Historically 0o755 was used, so we can't + # just error out on this, at least for a while. + if hasattr(os, "getuid"): + rootdir_stat = rootdir.stat() + uid = os.getuid() + # getuid shouldn't fail, but cpython defines such a case. + # Let's hope for the best. + if uid != -1: + if rootdir_stat.st_uid != uid: + raise OSError( + f"The temporary directory {rootdir} is not owned by the current user. " + "Fix this and try again." + ) + if (rootdir_stat.st_mode & 0o077) != 0: + os.chmod(rootdir, rootdir_stat.st_mode & ~0o077) basetemp = make_numbered_dir_with_cleanup( - prefix="pytest-", root=rootdir, keep=3, lock_timeout=LOCK_TIMEOUT + prefix="pytest-", + root=rootdir, + keep=3, + lock_timeout=LOCK_TIMEOUT, + mode=0o700, ) assert basetemp is not None, basetemp - self._basetemp = t = basetemp - self._trace("new basetemp", t) - return t + self._basetemp = basetemp + self._trace("new basetemp", basetemp) + return basetemp @final diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/src/pytest.egg-info/PKG-INFO new/pytest-6.2.4/src/pytest.egg-info/PKG-INFO --- old/pytest-6.2.2/src/pytest.egg-info/PKG-INFO 2021-01-25 15:51:33.000000000 +0100 +++ new/pytest-6.2.4/src/pytest.egg-info/PKG-INFO 2021-05-04 18:21:54.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pytest -Version: 6.2.2 +Version: 6.2.4 Summary: pytest: simple powerful testing with Python Home-page: https://docs.pytest.org/en/latest/ Author: Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/src/pytest.egg-info/SOURCES.txt new/pytest-6.2.4/src/pytest.egg-info/SOURCES.txt --- old/pytest-6.2.2/src/pytest.egg-info/SOURCES.txt 2021-01-25 15:51:34.000000000 +0100 +++ new/pytest-6.2.4/src/pytest.egg-info/SOURCES.txt 2021-05-04 18:21:54.000000000 +0200 @@ -237,6 +237,8 @@ doc/en/announce/release-6.2.0.rst doc/en/announce/release-6.2.1.rst doc/en/announce/release-6.2.2.rst +doc/en/announce/release-6.2.3.rst +doc/en/announce/release-6.2.4.rst doc/en/announce/sprint2016.rst doc/en/example/attic.rst doc/en/example/conftest.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-6.2.2/testing/test_tmpdir.py new/pytest-6.2.4/testing/test_tmpdir.py --- old/pytest-6.2.2/testing/test_tmpdir.py 2021-01-25 15:51:22.000000000 +0100 +++ new/pytest-6.2.4/testing/test_tmpdir.py 2021-05-04 18:21:46.000000000 +0200 @@ -445,3 +445,44 @@ # running a second time and ensure we don't crash result = pytester.runpytest("--basetemp=tmp") assert result.ret == 0 + + [email protected](not hasattr(os, "getuid"), reason="checks unix permissions") +def test_tmp_path_factory_create_directory_with_safe_permissions( + tmp_path: Path, monkeypatch, +) -> None: + """Verify that pytest creates directories under /tmp with private permissions.""" + # Use the test's tmp_path as the system temproot (/tmp). + monkeypatch.setenv("PYTEST_DEBUG_TEMPROOT", str(tmp_path)) + tmp_factory = TempPathFactory(None, lambda *args: None, _ispytest=True) + basetemp = tmp_factory.getbasetemp() + + # No world-readable permissions. + assert (basetemp.stat().st_mode & 0o077) == 0 + # Parent too (pytest-of-foo). + assert (basetemp.parent.stat().st_mode & 0o077) == 0 + + [email protected](not hasattr(os, "getuid"), reason="checks unix permissions") +def test_tmp_path_factory_fixes_up_world_readable_permissions( + tmp_path: Path, monkeypatch, +) -> None: + """Verify that if a /tmp/pytest-of-foo directory already exists with + world-readable permissions, it is fixed. + + pytest used to mkdir with such permissions, that's why we fix it up. + """ + # Use the test's tmp_path as the system temproot (/tmp). + monkeypatch.setenv("PYTEST_DEBUG_TEMPROOT", str(tmp_path)) + tmp_factory = TempPathFactory(None, lambda *args: None, _ispytest=True) + basetemp = tmp_factory.getbasetemp() + + # Before - simulate bad perms. + os.chmod(basetemp.parent, 0o777) + assert (basetemp.parent.stat().st_mode & 0o077) != 0 + + tmp_factory = TempPathFactory(None, lambda *args: None, _ispytest=True) + basetemp = tmp_factory.getbasetemp() + + # After - fixed. + assert (basetemp.parent.stat().st_mode & 0o077) == 0
