Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-pyfakefs for openSUSE:Factory 
checked in at 2022-10-14 15:40:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pyfakefs (Old)
 and      /work/SRC/openSUSE:Factory/.python-pyfakefs.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pyfakefs"

Fri Oct 14 15:40:16 2022 rev:15 rq:1010379 version:4.7.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pyfakefs/python-pyfakefs.changes  
2022-08-10 17:12:30.465583920 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-pyfakefs.new.2275/python-pyfakefs.changes    
    2022-10-14 15:40:26.651708490 +0200
@@ -1,0 +2,16 @@
+Wed Oct 12 14:10:11 UTC 2022 - Yogalakshmi Arunachalam <[email protected]>
+
+- Update to version 4.7.0 
+  Changes
+  fs fixtures cannot be nested; any nested fs fixture
+  (for example inside an fs_session or fs_module fixture) will just reference 
the outer fixture (the behavior had been unexpected before)
+  Fixes
+  reverted a performance optimization introduced in version 3.3.0 that caused 
hanging tests with installed torch (see #693)
+  do not use the build-in opener in pathlib as it may cause problems (see #697)
+  add support for path-like objects in shutil.disk_usage (see #699)
+  do not advertise support for Python 3.6 in setup.py (see #707)
+  return the expected type from fcntl.ioctl and fcntl.fcntl calls if arg is of 
type byte; the call itself does nothing as before
+  do not skip filesystem modules by name to allow using own modules with the 
same name (see #707)
+  add missing support for os.renames (see #714)
+
+-------------------------------------------------------------------

Old:
----
  python-pyfakefs-4.6.3.tar.gz

New:
----
  python-pyfakefs-4.7.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pyfakefs.spec ++++++
--- /var/tmp/diff_new_pack.303bDN/_old  2022-10-14 15:40:27.195709398 +0200
+++ /var/tmp/diff_new_pack.303bDN/_new  2022-10-14 15:40:27.199709405 +0200
@@ -27,7 +27,7 @@
 %endif
 %define skip_python2 1
 Name:           python-pyfakefs%{psuffix}
-Version:        4.6.3
+Version:        4.7.0
 Release:        0
 Summary:        Fake file system that mocks the Python file system modules
 License:        Apache-2.0

++++++ python-pyfakefs-4.6.3.tar.gz -> python-pyfakefs-4.7.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pyfakefs-4.6.3/.github/workflows/dockerfiles/Dockerfile_centos 
new/pyfakefs-4.7.0/.github/workflows/dockerfiles/Dockerfile_centos
--- old/pyfakefs-4.6.3/.github/workflows/dockerfiles/Dockerfile_centos  
2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/.github/workflows/dockerfiles/Dockerfile_centos  
2022-09-18 11:58:45.000000000 +0200
@@ -12,18 +12,21 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM centos:7
+FROM centos:latest
 MAINTAINER [email protected]
 
-ENV LANG en_US.UTF-8
-ENV LANGUAGE en_US:en
-ENV LC_ALL en_US.UTF-8
-
 ARG github_repo=jmcgeheeiv/pyfakefs
 ARG github_branch=master
 
+RUN cd /etc/yum.repos.d/
+RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
+RUN sed -i 
's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' 
/etc/yum.repos.d/CentOS-*
 RUN yum install -y python3-pip unzip wget
 
+ENV LANG en_US.UTF-8
+ENV LANGUAGE en_US:en
+ENV LC_COLLATE C.UTF-8
+
 RUN useradd -u 1000 pyfakefs
 
 RUN mkdir -p work \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pyfakefs-4.6.3/.github/workflows/dockerfiles/Dockerfile_fedora 
new/pyfakefs-4.7.0/.github/workflows/dockerfiles/Dockerfile_fedora
--- old/pyfakefs-4.6.3/.github/workflows/dockerfiles/Dockerfile_fedora  
2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/.github/workflows/dockerfiles/Dockerfile_fedora  
2022-09-18 11:58:45.000000000 +0200
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM fedora:32
+FROM fedora:latest
 MAINTAINER [email protected]
 
 ENV LANG en_US.UTF-8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/.github/workflows/pythonpackage.yml 
new/pyfakefs-4.7.0/.github/workflows/pythonpackage.yml
--- old/pyfakefs-4.6.3/.github/workflows/pythonpackage.yml      2022-07-20 
20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/.github/workflows/pythonpackage.yml      2022-09-18 
11:58:45.000000000 +0200
@@ -135,8 +135,8 @@
         shell: bash
       - name: Run pytest tests
         run: |
-          export PY_VERSION=${{ matrix.python-version }}
-          $GITHUB_WORKSPACE/.github/workflows/run_pytest.sh
+          echo "$(python -m pytest 
pyfakefs/pytest_tests/pytest_plugin_failing_helper.py)" > ./testresult.txt
+          python -m pytest pyfakefs/pytest_tests
         shell: bash
 
   dependency-check:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/.github/workflows/run_pytest.sh 
new/pyfakefs-4.7.0/.github/workflows/run_pytest.sh
--- old/pyfakefs-4.6.3/.github/workflows/run_pytest.sh  2022-07-20 
20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/.github/workflows/run_pytest.sh  1970-01-01 
01:00:00.000000000 +0100
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-python -m pytest pyfakefs/pytest_tests/pytest_plugin_test.py
-if [[ $PY_VERSION == '3.6' ]] || [[ $PY_VERSION == '3.7' ]] || [[ $PY_VERSION 
== '3.8' ]] || [[ $PY_VERSION == '3.9' ]] ; then
-    python -m pytest pyfakefs/pytest_tests/pytest_fixture_test.py
-fi
-python -m pytest pyfakefs/pytest_tests/pytest_plugin_failing_helper.py > 
./testresult.txt
-python -m pytest pyfakefs/pytest_tests/pytest_check_failed_plugin_test.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/CHANGES.md 
new/pyfakefs-4.7.0/CHANGES.md
--- old/pyfakefs-4.6.3/CHANGES.md       2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/CHANGES.md       2022-09-18 11:58:45.000000000 +0200
@@ -1,6 +1,29 @@
 # pyfakefs Release Notes
 The released versions correspond to PyPi releases.
 
+## [Version 4.7.0](https://pypi.python.org/pypi/pyfakefs/4.7.0) (2022-09-18)
+Changed handling of nested fixtures and bug fixes.
+
+### Changes
+* `fs` fixtures cannot be nested; any nested `fs` fixture (for example 
+  inside an `fs_session` or `fs_module` fixture) will just reference the outer
+  fixture (the behavior had been unexpected before)
+
+### Fixes
+* reverted a performance optimization introduced in version 3.3.0 that
+  caused hanging tests with installed torch (see [#693](../../issues/693))
+* do not use the build-in opener in `pathlib` as it may cause problems
+  (see [#697](../../issues/697))
+* add support for path-like objects in `shutil.disk_usage`
+  (see [#699](../../issues/699))
+* do not advertise support for Python 3.6 in `setup.py`
+  (see [#707](../../issues/707))
+* return the expected type from `fcntl.ioctl` and `fcntl.fcntl` calls if `arg`
+  is of type `byte`; the call itself does nothing as before 
+* do not skip filesystem modules by name to allow using own modules with 
+  the same name (see [#707](../../issues/707))
+* add missing support for `os.renames` (see [#714](../../issues/714))
+
 ## [Version 4.6.3](https://pypi.python.org/pypi/pyfakefs/4.6.3) (2022-07-20)
 Another patch release that fixes a regression in version 4.6.
 
@@ -44,7 +67,7 @@
 ### Changes
 * Python 3.6 has reached its end of life on 2021/12/23 and is no
   longer officially supported by pyfakefs
-  ** `os.stat_float_times` has been removed in Python 3.7 and is therefore no 
+  * `os.stat_float_times` has been removed in Python 3.7 and is therefore no 
      longer supported
 * under Windows, the root path is now effectively `C:\` instead of `\`; a 
   path starting with `\` points to the current drive as in the real file 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/README.md new/pyfakefs-4.7.0/README.md
--- old/pyfakefs-4.6.3/README.md        2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/README.md        2022-09-18 11:58:45.000000000 +0200
@@ -21,10 +21,6 @@
   * The [Release 3.7 
documentation](http://jmcgeheeiv.github.io/pyfakefs/release37)
     contains usage documentation for the last version of pyfakefs 
     supporting Python 2.7
-  * The [Release 3.3 
documentation](http://jmcgeheeiv.github.io/pyfakefs/release33)
-    contains usage documentation for the last version of pyfakefs 
-    supporting Python 2.6, and for the old-style API (which is still 
-    supported but not documented in the current release)
 * The [Release 
Notes](https://github.com/jmcgeheeiv/pyfakefs/blob/master/CHANGES.md) 
   show a list of changes in the latest versions
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/docs/autopatch.rst 
new/pyfakefs-4.7.0/docs/autopatch.rst
--- old/pyfakefs-4.6.3/docs/autopatch.rst       2022-07-20 20:43:14.000000000 
+0200
+++ new/pyfakefs-4.7.0/docs/autopatch.rst       2022-09-18 11:58:45.000000000 
+0200
@@ -11,6 +11,11 @@
 - ``example_test.py`` tests ``example.py``. During testing, the pyfakefs fake
   file system is used by ``example_test.py`` and ``example.py`` alike.
 
+.. note:: This example uses the Python ``unittest`` module for testing, but the
+  functionality is similar if using the ``fs`` fixture in ``pytest``,
+  the ``patchfs`` decorator, or the ``Patcher`` class.
+
+
 Software Under Test
 -------------------
 ``example.py`` contains a few functions that manipulate files.  For instance:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/docs/conf.py 
new/pyfakefs-4.7.0/docs/conf.py
--- old/pyfakefs-4.6.3/docs/conf.py     2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/docs/conf.py     2022-09-18 11:58:45.000000000 +0200
@@ -58,7 +58,7 @@
 project = 'pyfakefs'
 copyright = '''2009 Google Inc. All Rights Reserved.
 ?? Copyright 2014 Altera Corporation. All Rights Reserved.
-?? Copyright 2014-2021 John McGehee'''
+?? Copyright 2014-2022 John McGehee'''
 author = 'John McGehee'
 
 # The version info for the project you're documenting, acts as replacement for
@@ -66,16 +66,16 @@
 # built documents.
 #
 # The short X.Y version.
-version = '4.6.3'
+version = '4.7.0'
 # The full version, including alpha/beta/rc tags.
-release = '4.6.3'
+release = '4.7.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
 #
 # This is also used if you do content translation via gettext catalogs.
 # Usually you set "language" from the command line for these cases.
-language = None
+language = 'en'
 
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/docs/index.rst 
new/pyfakefs-4.7.0/docs/index.rst
--- old/pyfakefs-4.6.3/docs/index.rst   2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/docs/index.rst   2022-09-18 11:58:45.000000000 +0200
@@ -13,6 +13,7 @@
 
    intro
    usage
+   troubleshooting
    autopatch
    modules
    api
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/docs/intro.rst 
new/pyfakefs-4.7.0/docs/intro.rst
--- old/pyfakefs-4.6.3/docs/intro.rst   2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/docs/intro.rst   2022-09-18 11:58:45.000000000 +0200
@@ -89,6 +89,12 @@
   other means (e.g. using `unittest.mock.patch`) - see
   :ref:`usage_with_mock_open` for more information
 
+- pyfakefs will not work correctly with
+  `behave <https://github.com/behave/behave>`__ due to the way it loads
+  the steps, if any filesystem modules are imported globally in the steps or
+  environment files; as a workaround, you may load them locally inside the
+  test steps (see `this issue 
<https://github.com/jmcgeheeiv/pyfakefs/issues/703>`__)
+
 History
 -------
 pyfakefs was initially developed at Google by
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/docs/troubleshooting.rst 
new/pyfakefs-4.7.0/docs/troubleshooting.rst
--- old/pyfakefs-4.6.3/docs/troubleshooting.rst 1970-01-01 01:00:00.000000000 
+0100
+++ new/pyfakefs-4.7.0/docs/troubleshooting.rst 2022-09-18 11:58:45.000000000 
+0200
@@ -0,0 +1,208 @@
+Troubleshooting
+===============
+This is a collection of problems with ``pyfakefs`` and possible solutions.
+It will be expanded continuously based on issues and problems found by users.
+
+Modules not working with pyfakefs
+---------------------------------
+
+Modules may not work with ``pyfakefs`` for several reasons. ``pyfakefs``
+works by patching some file system related modules and functions, specifically:
+
+- most file system related functions in the ``os`` and ``os.path`` modules
+- the ``pathlib`` module
+- the build-in ``open`` function and ``io.open``
+- ``shutil.disk_usage``
+
+Other file system related modules work with ``pyfakefs``, because they use
+exclusively these patched functions, specifically ``shutil`` (except for
+``disk_usage``), ``tempfile``, ``glob`` and ``zipfile``.
+
+A module may not work with ``pyfakefs`` because of one of the following
+reasons:
+
+- It uses a file system related function of the mentioned modules that is
+  not or not correctly patched. Mostly these are functions that are seldom
+  used, but may be used in Python libraries (this has happened for example
+  with a changed implementation of ``shutil`` in Python 3.7). Generally,
+  these shall be handled in issues and we are happy to fix them.
+- It uses file system related functions in a way that will not be patched
+  automatically. This is the case for functions that are executed while
+  reading a module. This case and a possibility to make them work is
+  documented above under ``modules_to_reload``.
+- It uses OS specific file system functions not contained in the Python
+  libraries. These will not work out of the box, and we generally will not
+  support them in ``pyfakefs``. If these functions are used in isolated
+  functions or classes, they may be patched by using the ``modules_to_patch``
+  parameter (see the example for file locks in Django above), or by using
+  ``unittest.patch`` if you don't need to simulate the functions. We
+  added some of these patches to ``pyfakefs``, so that they are applied
+  automatically (currently done for some ``pandas`` and ``Django``
+  functionality).
+- It uses C libraries to access the file system. There is no way no make
+  such a module work with ``pyfakefs``--if you want to use it, you
+  have to patch the whole module. In some cases, a library implemented in
+  Python with a similar interface already exists. An example is ``lxml``,
+  which can be substituted with ``ElementTree`` in most cases for testing.
+
+A list of Python modules that are known to not work correctly with
+``pyfakefs`` will be collected here:
+
+`multiprocessing`_ (build-in)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+This module has several issues (related to points 1 and 3 above).
+Currently there are no plans to fix this, but this may change in case of
+sufficient demand.
+
+`subprocess`_ (build-in)
+~~~~~~~~~~~~~~~~~~~~~~~~
+This has very similar problems to ``multiprocessing`` and cannot be used with
+``pyfakefs`` to start a process. ``subprocess`` can either be mocked, if
+the process is not needed for the test, or patching can be paused to start
+a process if needed, and resumed afterwards
+(see `this issue <https://github.com/jmcgeheeiv/pyfakefs/issues/447>`__).
+
+Modules that rely on ``subprocess`` or ``multiprocessing``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+This includes a number of modules that need to start other executables to
+function correctly. Examples that have shown this problem include `GitPython`_
+and `plumbum`_.
+
+The `Pillow`_ Imaging Library
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+This library partly works with ``pyfakefs``, but it is known to not work at
+least if writing JPEG files
+(see `this issue <https://github.com/jmcgeheeiv/pyfakefs/issues/529>`__)
+
+The `pandas`_ data analysis toolkit
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+This uses its own internal file system access written in C, thus much of
+``pandas`` will not work with ``pyfakefs`` out of the box. Having said that,
+``pyfakefs`` patches ``pandas`` to use standard file-system access instead,
+so that many of the ``read_xxx`` functions, including ``read_csv`` and
+``read_excel``, as well as some writer functions, do work with the fake file
+system. If you use only these functions, ``pyfakefs`` should work fine with
+``pandas``.
+
+`xlrd`_
+~~~~~~~
+This library is used by ``pandas`` to read Excel files in the `.xls` format,
+and can also be used stand-alone. Similar to ``pandas``, it is by default
+patched by ``pyfakefs`` to use normal file system functions that can be
+patched.
+
+`openpyxl`_
+~~~~~~~~~~~
+This is another library that reads and writes Excel files, and is also
+used by ``pandas`` if installed. ``openpyxl`` uses ``lxml`` for some 
file-system
+access if it is installed--in this case ``pyfakefs`` will not be able to patch
+it correctly (``lxml`` uses C functions for file system access). It will `not`
+use ``lxml`` however, if the environment variable ``OPENPYXL_LXML`` is set to
+"False" (or anything other than "True"), so if you set this variable `before`
+running the tests, it can work fine with ``pyfakefs``.
+
+If you encounter a module not working with ``pyfakefs``, and you are not sure
+if the module can be handled or how to do it, please write a new issue. We
+will check if it can be made to work, and at least add it to this list.
+
+Pyfakefs behaves differently than the real filesystem
+-----------------------------------------------------
+There are at least the following kinds of deviations from the actual behavior:
+
+- unwanted deviations that we didn't notice--if you find any of these, please
+  write an issue and we will try to fix it
+- behavior that depends on different OS versions and editions--as mentioned
+  in :ref:`limitations`, ``pyfakefs`` uses the TravisCI systems as reference
+  system and will not replicate all system-specific behavior
+- behavior that depends on low-level OS functionality that ``pyfakefs`` is not
+  able to emulate; examples are the ``fcntl.ioctl`` and ``fcntl.fcntl``
+  functions that are patched to do nothing
+
+The test code tries to access files in the real filesystem
+----------------------------------------------------------
+The loading of the actual Python code from the real filesystem does not use
+the filesystem functions that ``pyfakefs`` patches, but in some cases it may
+access other files in the packages. An example is loading timezone information
+from configuration files. In these cases, you have to map the respective files
+or directories from the real into the fake filesystem as described in
+:ref:`real_fs_access`.
+
+
+OS temporary directories
+------------------------
+Tests relying on a completely empty file system on test start will fail.
+As ``pyfakefs`` does not fake the ``tempfile`` module (as described above),
+a temporary directory is required to ensure that ``tempfile`` works correctly,
+e.g., that ``tempfile.gettempdir()`` will return a valid value. This
+means that any newly created fake file system will always have either a
+directory named ``/tmp`` when running on Linux or Unix systems,
+``/var/folders/<hash>/T`` when running on MacOs, or
+``C:\Users\<user>\AppData\Local\Temp`` on Windows:
+
+.. code:: python
+
+  import os
+
+  def test_something(fs):
+      # the temp directory is always present at test start
+      assert len(os.listdir("/")) == 1
+
+
+User rights
+-----------
+If you run ``pyfakefs`` tests as root (this happens by default if run in a
+docker container), ``pyfakefs`` also behaves as a root user, for example can
+write to write-protected files. This may not be the expected behavior, and
+can be changed.
+``Pyfakefs`` has a rudimentary concept of user rights, which differentiates
+between root user (with the user id 0) and any other user. By default,
+``pyfakefs`` assumes the user id of the current user, but you can change
+that using ``fake_filesystem.set_uid()`` in your setup. This allows to run
+tests as non-root user in a root user environment and vice verse.
+Another possibility to run tests as non-root user in a root user environment
+is the convenience argument :ref:`allow_root_user`:
+
+.. code:: python
+
+  from pyfakefs.fake_filesystem_unittest import TestCase
+
+  class SomeTest(TestCase):
+      def setUp(self):
+          self.setUpPyfakefs(allow_root_user=False)
+
+
+.. _usage_with_mock_open:
+
+Pyfakefs and mock_open
+----------------------
+If you patch ``open`` using ``mock_open`` before the initialization of
+``pyfakefs``, it will not work properly, because the ``pyfakefs``
+initialization relies on ``open`` working correctly.
+Generally, you should not need ``mock_open`` if using ``pyfakefs``, because you
+always can create the files with the needed content using ``create_file``.
+This is true for patching any filesystem functions--avoid patching them
+while working with ``pyfakefs``.
+If you still want to use ``mock_open``, make sure it is only used while
+patching is in progress. For example, if you are using ``pytest`` with the
+``mocker`` fixture used to patch ``open``, make sure that the ``fs`` fixture is
+passed before the ``mocker`` fixture to ensure this:
+
+.. code:: python
+
+  def test_mock_open_incorrect(mocker, fs):
+      # causes a recursion error
+      mocker.patch('builtins.open', mocker.mock_open(read_data="content"))
+
+  def test_mock_open_correct(fs, mocker):
+      # works correctly
+      mocker.patch('builtins.open', mocker.mock_open(read_data="content"))
+
+
+.. _`multiprocessing`: https://docs.python.org/3/library/multiprocessing.html
+.. _`subprocess`: https://docs.python.org/3/library/subprocess.html
+.. _`GitPython`: https://pypi.org/project/GitPython/
+.. _`plumbum`: https://pypi.org/project/plumbum/
+.. _`Pillow`: https://pypi.org/project/Pillow/
+.. _`pandas`: https://pypi.org/project/pandas/
+.. _`xlrd`: https://pypi.org/project/xlrd/
+.. _`openpyxl`: https://pypi.org/project/openpyxl/
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/docs/usage.rst 
new/pyfakefs-4.7.0/docs/usage.rst
--- old/pyfakefs-4.6.3/docs/usage.rst   2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/docs/usage.rst   2022-09-18 11:58:45.000000000 +0200
@@ -64,10 +64,16 @@
         """
         yield fs
 
+Module- and session scoped fixtures
+...................................
 For convenience, module- and session-scoped fixtures with the same
 functionality are provided, named ``fs_module`` and ``fs_session``,
 respectively.
 
+.. caution:: If any of these fixtures is active, any other ``fs`` fixture will
+  not setup / tear down the fake filesystem in the current scope; instead, it
+  will just serve as a reference to the active fake filesystem.
+
 
 Patch using fake_filesystem_unittest.Patcher
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -382,6 +388,11 @@
       fs.create_dir(file_path)
       assert example.sut.check_if_exists(file_path)
 
+      
+.. note:: If the reloaded modules depend on each other (e.g. one imports the 
other), 
+  the order in which they are reloaded matters. The dependent module should be 
reloaded 
+  first, so that on reloading the depending module it is already correctly 
patched. 
+
 
 modules_to_patch
 ................
@@ -530,6 +541,30 @@
 You could also use the :ref:`modules_to_reload` option with the module that
 contains the default argument instead, if you want to avoid the overhead.
 
+.. note:: There are some cases where this option dees not work:
+
+  - if default arguments are *computed* using file system functions:
+
+    .. code:: python
+
+      import os
+
+      def some_function(use_bar=os.path.exists("/foo/bar")):
+          return do_something() if use_bar else do_something_else()
+
+  - if the default argument is an instance of ``pathlib.Path``:
+
+    .. code:: python
+
+      import pathlib
+
+      def foobar(dir_arg = pathlib.Path.cwd() / 'logs'):
+          do_something(dir_arg)
+
+  In both cases the default arguments behave like global variables that use a 
file system function
+  (which they basically are), and can only be handled using 
:ref:`modules_to_reload`.
+
+
 use_cache
 .........
 If True (the default), patched and non-patched modules are cached between tests
@@ -602,6 +637,8 @@
   The first two arguments in ``create_symlink`` are reverted in relation to
   ``os.symlink`` for historical reasons.
 
+.. _real_fs_access:
+
 Access to files in the real file system
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 If you want to have read access to real files or directories, you can map
@@ -806,138 +843,9 @@
       assert os.path.splitdrive(r"C:\foo\bar") == ("C:", r"\foo\bar")
       assert os.path.ismount("C:")
 
-Troubleshooting
----------------
-
-Modules not working with pyfakefs
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Modules may not work with ``pyfakefs`` for several reasons. ``pyfakefs``
-works by patching some file system related modules and functions, specifically:
-
-- most file system related functions in the ``os`` and ``os.path`` modules
-- the ``pathlib`` module
-- the build-in ``open`` function and ``io.open``
-- ``shutil.disk_usage``
-
-Other file system related modules work with ``pyfakefs``, because they use
-exclusively these patched functions, specifically ``shutil`` (except for
-``disk_usage``), ``tempfile``, ``glob`` and ``zipfile``.
-
-A module may not work with ``pyfakefs`` because of one of the following
-reasons:
-
-- It uses a file system related function of the mentioned modules that is
-  not or not correctly patched. Mostly these are functions that are seldom
-  used, but may be used in Python libraries (this has happened for example
-  with a changed implementation of ``shutil`` in Python 3.7). Generally,
-  these shall be handled in issues and we are happy to fix them.
-- It uses file system related functions in a way that will not be patched
-  automatically. This is the case for functions that are executed while
-  reading a module. This case and a possibility to make them work is
-  documented above under ``modules_to_reload``.
-- It uses OS specific file system functions not contained in the Python
-  libraries. These will not work out of the box, and we generally will not
-  support them in ``pyfakefs``. If these functions are used in isolated
-  functions or classes, they may be patched by using the ``modules_to_patch``
-  parameter (see the example for file locks in Django above), or by using
-  ``unittest.patch`` if you don't need to simulate the functions. We
-  added some of these patches to ``pyfakefs``, so that they are applied
-  automatically (currently done for some ``pandas`` and ``Django``
-  functionality).
-- It uses C libraries to access the file system. There is no way no make
-  such a module work with ``pyfakefs``--if you want to use it, you
-  have to patch the whole module. In some cases, a library implemented in
-  Python with a similar interface already exists. An example is ``lxml``,
-  which can be substituted with ``ElementTree`` in most cases for testing.
-
-A list of Python modules that are known to not work correctly with
-``pyfakefs`` will be collected here:
-
-- `multiprocessing`_ has several issues (related to points 1 and 3 above).
-  Currently there are no plans to fix this, but this may change in case of
-  sufficient demand.
-- `subprocess`_ has very similar problems and cannot be used with
-  ``pyfakefs`` to start a process. ``subprocess`` can either be mocked, if
-  the process is not needed for the test, or patching can be paused to start
-  a process if needed, and resumed afterwards
-  (see `this issue <https://github.com/jmcgeheeiv/pyfakefs/issues/447>`__).
-- Modules that rely on ``subprocess`` or ``multiprocessing`` to work
-  correctly, e.g. need to start other executables. Examples that have shown
-  this problem include `GitPython`_ and `plumbum`_.
-- the `Pillow`_ image library does not work with pyfakefs at least if writing
-  JPEG files (see `this issue 
<https://github.com/jmcgeheeiv/pyfakefs/issues/529>`__)
-- `pandas`_ (the Python data analysis library) uses its own internal file
-  system access written in C. Thus much of ``pandas`` will not work with
-  ``pyfakefs``. Having said that, ``pyfakefs`` patches ``pandas`` so that many
-  of the ``read_xxx`` functions, including ``read_csv`` and ``read_excel``,
-  as well as some writer functions, do work with the fake file system. If
-  you use only these functions, ``pyfakefs`` will work with ``pandas``.
-
-If you are not sure if a module can be handled, or how to do it, you can
-always write a new issue, of course!
-
-Pyfakefs behaves differently than the real filesystem
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-There are basically two kinds of deviations from the actual behavior:
-
-- unwanted deviations that we didn't notice--if you find any of these, please
-  write an issue and will try to fix it
-- behavior that depends on different OS versions and editions--as mentioned
-  in :ref:`limitations`, ``pyfakefs`` uses the TravisCI systems as reference
-  system and will not replicate all system-specific behavior
-
-OS temporary directories
-~~~~~~~~~~~~~~~~~~~~~~~~
-
-Tests relying on a completely empty file system on test start will fail.
-As ``pyfakefs`` does not fake the ``tempfile`` module (as described above),
-a temporary directory is required to ensure ``tempfile`` works correctly,
-e.g., that ``tempfile.gettempdir()`` will return a valid value. This
-means that any newly created fake file system will always have either a
-directory named ``/tmp`` when running on Linux or Unix systems,
-``/var/folders/<hash>/T`` when running on MacOs, or
-``C:\Users\<user>\AppData\Local\Temp`` on Windows.
-
-User rights
-~~~~~~~~~~~
-
-If you run ``pyfakefs`` tests as root (this happens by default if run in a
-docker container), ``pyfakefs`` also behaves as a root user, for example can
-write to write-protected files. This may not be the expected behavior, and
-can be changed.
-``Pyfakefs`` has a rudimentary concept of user rights, which differentiates
-between root user (with the user id 0) and any other user. By default,
-``pyfakefs`` assumes the user id of the current user, but you can change
-that using ``fake_filesystem.set_uid()`` in your setup. This allows to run
-tests as non-root user in a root user environment and vice verse.
-Another possibility to run tests as non-root user in a root user environment
-is the convenience argument :ref:`allow_root_user`.
-
-.. _usage_with_mock_open:
-
-Pyfakefs and mock_open
-~~~~~~~~~~~~~~~~~~~~~~
-If you patch ``open`` using ``mock_open`` before the initialization of
-``pyfakefs``, it will not work properly, because the ``pyfakefs``
-initialization relies on ``open`` working correctly.
-Generally, you should not need ``mock_open`` if using ``pyfakefs``, because you
-always can create the files with the needed content using ``create_file``.
-This is true for patching any filesystem functions - avoid patching them
-while working with ``pyfakefs``.
-If you still want to use ``mock_open``, make sure it is only used while
-patching is in progress. For example, if you are using ``pytest`` with the
-``mocker`` fixture used to patch ``open``, make sure that the ``fs`` fixture is
-passed before the ``mocker`` fixture to ensure this.
 
 .. _`example.py`: 
https://github.com/jmcgeheeiv/pyfakefs/blob/master/pyfakefs/tests/example.py
 .. _`example_test.py`: 
https://github.com/jmcgeheeiv/pyfakefs/blob/master/pyfakefs/tests/example_test.py
 .. _`pytest`: https://doc.pytest.org
 .. _`nose`: https://docs.nose2.io/en/latest/
 .. _`all Patcher arguments`: 
https://jmcgeheeiv.github.io/pyfakefs/master/modules.html#pyfakefs.fake_filesystem_unittest.Patcher
-.. _`multiprocessing`: https://docs.python.org/3/library/multiprocessing.html
-.. _`subprocess`: https://docs.python.org/3/library/subprocess.html
-.. _`GitPython`: https://pypi.org/project/GitPython/
-.. _`plumbum`: https://pypi.org/project/plumbum/
-.. _`Pillow`: https://pypi.org/project/Pillow/
-.. _`pandas`: https://pypi.org/project/pandas/
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/extra_requirements.txt 
new/pyfakefs-4.7.0/extra_requirements.txt
--- old/pyfakefs-4.6.3/extra_requirements.txt   2022-07-20 20:43:14.000000000 
+0200
+++ new/pyfakefs-4.7.0/extra_requirements.txt   2022-09-18 11:58:45.000000000 
+0200
@@ -15,7 +15,7 @@
 # we use the latest version to see any problems with new versions
 pandas==1.1.5; python_version <= '3.6'
 pandas==1.3.5; python_version == '3.7'
-pandas==1.4.1; python_version > '3.7'
+pandas==1.4.4; python_version > '3.7'
 xlrd==1.2.0; python_version <= '3.6'
 xlrd==2.0.1; python_version > '3.6'
 openpyxl==3.0.10
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/pyfakefs/_version.py 
new/pyfakefs-4.7.0/pyfakefs/_version.py
--- old/pyfakefs-4.6.3/pyfakefs/_version.py     2022-07-20 20:43:14.000000000 
+0200
+++ new/pyfakefs-4.7.0/pyfakefs/_version.py     2022-09-18 11:58:45.000000000 
+0200
@@ -1 +1 @@
-__version__ = '4.6.3'
+__version__ = '4.7.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/pyfakefs/fake_filesystem.py 
new/pyfakefs-4.7.0/pyfakefs/fake_filesystem.py
--- old/pyfakefs-4.6.3/pyfakefs/fake_filesystem.py      2022-07-20 
20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/pyfakefs/fake_filesystem.py      2022-09-18 
11:58:45.000000000 +0200
@@ -1285,7 +1285,8 @@
         if path is None:
             mount_point = next(iter(self.mount_points.values()))
         else:
-            mount_point = self._mount_point_for_path(path)
+            file_path = make_string_path(path)
+            mount_point = self._mount_point_for_path(file_path)
         if mount_point and mount_point['total_size'] is not None:
             return DiskUsage(mount_point['total_size'],
                              mount_point['used_size'],
@@ -4395,7 +4396,8 @@
 
     def lstat(self, path: AnyStr, *,
               dir_fd: Optional[int] = None) -> FakeStatResult:
-        """Return the os.stat-like tuple for entry_path, not following 
symlinks.
+        """Return the os.stat-like tuple for entry_path,
+        not following symlinks.
 
         Args:
             path:  path to filesystem object to retrieve.
@@ -4475,6 +4477,32 @@
         dst = self._path_with_dir_fd(dst, self.rename, dst_dir_fd)
         self.filesystem.rename(src, dst)
 
+    def renames(self, old: AnyStr, new: AnyStr):
+        """Fakes `os.renames`, documentation taken from there.
+
+        Super-rename; create directories as necessary and delete any left
+        empty.  Works like rename, except creation of any intermediate
+        directories needed to make the new pathname good is attempted
+        first.  After the rename, directories corresponding to rightmost
+        path segments of the old name will be pruned until either the
+        whole path is consumed or a nonempty directory is found.
+
+        Note: this function can fail with the new directory structure made
+        if you lack permissions needed to unlink the leaf directory or
+        file.
+
+        """
+        head, tail = self.filesystem.splitpath(new)
+        if head and tail and not self.filesystem.exists(head):
+            self.makedirs(head)
+        self.rename(old, new)
+        head, tail = self.filesystem.splitpath(old)
+        if head and tail:
+            try:
+                self.removedirs(head)
+            except OSError:
+                pass
+
     def replace(self, src: AnyStr, dst: AnyStr, *,
                 src_dir_fd: Optional[int] = None,
                 dst_dir_fd: Optional[int] = None) -> None:
@@ -5083,11 +5111,11 @@
             self._fcntl_module = fcntl
 
         def fcntl(self, fd: int, cmd: int, arg: int = 0) -> Union[int, bytes]:
-            return 0
+            return 0 if isinstance(arg, int) else arg
 
         def ioctl(self, fd: int, request: int, arg: int = 0,
                   mutate_flag: bool = True) -> Union[int, bytes]:
-            return 0
+            return 0 if isinstance(arg, int) else arg
 
         def flock(self, fd: int, operation: int) -> None:
             pass
@@ -5770,7 +5798,10 @@
 
         newline, open_modes = self._handle_file_mode(mode, newline, open_modes)
 
-        if opener is not None:
+        # the pathlib opener is defined in a Path instance that may not be
+        # patched under some circumstances; as it just calls standard open(),
+        # we may ignore it, as it would not change the behavior
+        if opener is not None and opener.__module__ != 'pathlib':
             # opener shall return a file descriptor, which will be handled
             # here as if directly passed
             file_ = opener(file_, self._open_flags_from_open_modes(open_modes))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/pyfakefs/fake_filesystem_unittest.py 
new/pyfakefs-4.7.0/pyfakefs/fake_filesystem_unittest.py
--- old/pyfakefs-4.6.3/pyfakefs/fake_filesystem_unittest.py     2022-07-20 
20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/pyfakefs/fake_filesystem_unittest.py     2022-09-18 
11:58:45.000000000 +0200
@@ -35,10 +35,14 @@
 pyfakefs by simply changing their base class from `:py:class`unittest.TestCase`
 to `:py:class`pyfakefs.fake_filesystem_unittest.TestCase`.
 """
+import _io  # type:ignore [import]
 import doctest
 import functools
+import genericpath
 import inspect
+import io
 import linecache
+import os
 import shutil
 import sys
 import tempfile
@@ -366,8 +370,6 @@
     '''Stub nothing that is imported within these modules.
     `sys` is included to prevent `sys.path` from being stubbed with the fake
     `os.path`.
-    The `pytest` and `py` modules are used by pytest and have to access the
-    real file system.
     The `linecache` module is used to read the test file in case of test
     failure to get traceback information before test tear down.
     In order to make sure that reading the test file is not faked,
@@ -376,8 +378,21 @@
     '''
     SKIPMODULES = {
         None, fake_filesystem, fake_filesystem_shutil,
-        sys, linecache, tokenize
+        sys, linecache, tokenize, os, io, _io, genericpath, os.path
     }
+    if sys.platform == 'win32':
+        import nt  # type:ignore [import]
+        import ntpath
+        SKIPMODULES.add(nt)
+        SKIPMODULES.add(ntpath)
+    else:
+        import posix
+        import posixpath
+        import fcntl
+        SKIPMODULES.add(posix)
+        SKIPMODULES.add(posixpath)
+        SKIPMODULES.add(fcntl)
+
     # caches all modules that do not have file system modules or function
     # to speed up _find_modules
     CACHED_MODULES: Set[ModuleType] = set()
@@ -391,13 +406,19 @@
 
     IS_WINDOWS = sys.platform in ('win32', 'cygwin')
 
-    SKIPNAMES = {'os', 'path', 'io', 'genericpath', 'fcntl',
-                 OS_MODULE, PATH_MODULE}
+    SKIPNAMES: Set[str] = set()
 
     # hold values from last call - if changed, the cache has to be invalidated
     PATCHED_MODULE_NAMES: Set[str] = set()
     ADDITIONAL_SKIP_NAMES: Set[str] = set()
     PATCH_DEFAULT_ARGS = False
+    PATCHER = None
+    REF_COUNT = 0
+
+    def __new__(cls, *args, **kwargs):
+        if cls.PATCHER is None:
+            cls.PATCHER = super().__new__(cls)
+        return cls.PATCHER
 
     def __init__(self, additional_skip_names: Optional[
         List[Union[str, ModuleType]]] = None,
@@ -439,7 +460,8 @@
                 feature, this argument allows to turn it off in case it
                 causes any problems.
         """
-
+        if self.REF_COUNT > 0:
+            return
         if not allow_root_user:
             # set non-root IDs even if the real user is root
             set_uid(1)
@@ -605,34 +627,26 @@
                       name: str,
                       module_names: List[str]) -> bool:
         try:
-            # check for __name__ first and ignore the AttributeException
-            # if it does not exist - avoids calling expansive ismodule
-            if mod.__name__ in module_names and inspect.ismodule(mod):
-                return True
-        except Exception:
-            pass
-        try:
-            if (name in self._class_modules and
-                    mod.__module__ in self._class_modules[name]):
-                return inspect.isclass(mod)
+            return (inspect.ismodule(mod) and
+                    mod.__name__ in module_names
+                    or inspect.isclass(mod) and
+                    mod.__module__ in self._class_modules.get(name, []))
         except Exception:
-            # handle AttributeError and any other exception possibly triggered
-            # by side effects of inspect methods
-            pass
-        return False
+            # handle cases where the module has no __name__ or __module__
+            # attribute - see #460, and any other exception triggered
+            # by inspect functions
+            return False
 
     def _is_fs_function(self, fct: FunctionType) -> bool:
         try:
-            # check for __name__ first and ignore the AttributeException
-            # if it does not exist - avoids calling expansive inspect
-            # methods in most cases
-            return (fct.__name__ in self._fake_module_functions and
+            return ((inspect.isfunction(fct) or
+                     inspect.isbuiltin(fct)) and
+                    fct.__name__ in self._fake_module_functions and
                     fct.__module__ in self._fake_module_functions[
-                        fct.__name__] and
-                    (inspect.isfunction(fct) or inspect.isbuiltin(fct)))
+                        fct.__name__])
         except Exception:
-            # handle AttributeError and any other exception possibly triggered
-            # by side effects of inspect methods
+            # handle cases where the function has no __name__ or __module__
+            # attribute, or any other exception in inspect functions
             return False
 
     def _def_values(
@@ -745,6 +759,9 @@
         """Bind the file-related modules to the :py:mod:`pyfakefs` fake
         modules real ones.  Also bind the fake `file()` and `open()` functions.
         """
+        self.__class__.REF_COUNT += 1
+        if self.__class__.REF_COUNT > 1:
+            return
         self.has_fcopy_file = (sys.platform == 'darwin' and
                                hasattr(shutil, '_HAS_FCOPYFILE') and
                                shutil._HAS_FCOPYFILE)
@@ -834,11 +851,15 @@
 
     def tearDown(self, doctester: Any = None):
         """Clear the fake filesystem bindings created by `setUp()`."""
+        self.__class__.REF_COUNT -= 1
+        if self.__class__.REF_COUNT > 0:
+            return
         self.stop_patching()
         if self.has_fcopy_file:
             shutil._HAS_FCOPYFILE = True  # type: ignore[attr-defined]
 
         reset_ids()
+        self.__class__.PATCHER = None
 
     def stop_patching(self) -> None:
         if self._patching:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/pyfakefs/pytest_tests/io.py 
new/pyfakefs-4.7.0/pyfakefs/pytest_tests/io.py
--- old/pyfakefs-4.6.3/pyfakefs/pytest_tests/io.py      1970-01-01 
01:00:00.000000000 +0100
+++ new/pyfakefs-4.7.0/pyfakefs/pytest_tests/io.py      2022-09-18 
11:58:45.000000000 +0200
@@ -0,0 +1,14 @@
+"""
+This is a test case for pyfakefs issue #708.
+It tests the usage of an own module with the same name as a patched filesystem
+module, the content is taken from the issue.
+"""
+
+
+class InputStream:
+    def __init__(self, name):
+        self.name = name
+
+    def read(self):
+        with open(self.name, 'r') as f:
+            return f.readline()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pyfakefs-4.6.3/pyfakefs/pytest_tests/pytest_module_fixture_test.py 
new/pyfakefs-4.7.0/pyfakefs/pytest_tests/pytest_module_fixture_test.py
--- old/pyfakefs-4.6.3/pyfakefs/pytest_tests/pytest_module_fixture_test.py      
1970-01-01 01:00:00.000000000 +0100
+++ new/pyfakefs-4.7.0/pyfakefs/pytest_tests/pytest_module_fixture_test.py      
2022-09-18 11:58:45.000000000 +0200
@@ -0,0 +1,25 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import os
+
+import pytest
+
+
[email protected](scope='module', autouse=True)
+def use_fs(fs_module):
+    fs_module.create_file(os.path.join('foo', 'bar'))
+    yield fs_module
+
+
+def test_fs_uses_fs_module(fs):
+    # check that `fs` uses the same filesystem as `fs_module`
+    assert os.path.exists(os.path.join('foo', 'bar'))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pyfakefs-4.6.3/pyfakefs/pytest_tests/pytest_plugin_test.py 
new/pyfakefs-4.7.0/pyfakefs/pytest_tests/pytest_plugin_test.py
--- old/pyfakefs-4.6.3/pyfakefs/pytest_tests/pytest_plugin_test.py      
2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/pyfakefs/pytest_tests/pytest_plugin_test.py      
2022-09-18 11:58:45.000000000 +0200
@@ -3,6 +3,7 @@
 import tempfile
 
 from pyfakefs.fake_filesystem_unittest import Pause
+import pyfakefs.pytest_tests.io
 
 
 def test_fs_fixture(fs):
@@ -50,3 +51,12 @@
         assert os.path.exists(real_temp_file.name)
     assert not os.path.exists(real_temp_file.name)
     assert os.path.exists(fake_temp_file.name)
+
+
+def test_use_own_io_module(fs):
+    filepath = 'foo.txt'
+    with open(filepath, 'w') as f:
+        f.write('bar')
+
+    stream = pyfakefs.pytest_tests.io.InputStream(filepath)
+    assert stream.read() == 'bar'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pyfakefs-4.6.3/pyfakefs/tests/fake_filesystem_shutil_test.py 
new/pyfakefs-4.7.0/pyfakefs/tests/fake_filesystem_shutil_test.py
--- old/pyfakefs-4.6.3/pyfakefs/tests/fake_filesystem_shutil_test.py    
2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/pyfakefs/tests/fake_filesystem_shutil_test.py    
2022-09-18 11:58:45.000000000 +0200
@@ -22,6 +22,7 @@
 import sys
 import tempfile
 import unittest
+from pathlib import Path
 
 from pyfakefs import fake_filesystem_unittest
 from pyfakefs.fake_filesystem import is_root, set_uid, USER_ID
@@ -351,7 +352,6 @@
         self.skip_real_fs()
         file_path = self.make_path('foo', 'bar')
         self.fs.create_file(file_path, st_size=400)
-        # root = self.os.path.splitdrive(file_path)[0] + self.fs.path_separator
         disk_usage = shutil.disk_usage(file_path)
         self.assertEqual(1000, disk_usage.total)
         self.assertEqual(400, disk_usage.used)
@@ -365,6 +365,17 @@
         disk_usage = shutil.disk_usage(dir_path)
         self.assertEqual((500, 400, 100), disk_usage)
 
+    def test_disk_usage_with_path(self):
+        self.skip_real_fs()
+        file_path = self.make_path('foo', 'bar')
+        self.fs.create_file(file_path, st_size=400)
+        path = Path(file_path)
+        disk_usage = shutil.disk_usage(path)
+        self.assertEqual(1000, disk_usage.total)
+        self.assertEqual(400, disk_usage.used)
+        self.assertEqual(600, disk_usage.free)
+        self.assertEqual((1000, 400, 600), disk_usage)
+
     def create_mount_point(self):
         mount_point = 'M:' if self.is_windows_fs else '/mount'
         self.fs.add_mount_point(mount_point, total_size=500)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/pyfakefs/tests/fake_os_test.py 
new/pyfakefs-4.7.0/pyfakefs/tests/fake_os_test.py
--- old/pyfakefs-4.6.3/pyfakefs/tests/fake_os_test.py   2022-07-20 
20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/pyfakefs/tests/fake_os_test.py   2022-09-18 
11:58:45.000000000 +0200
@@ -3328,6 +3328,28 @@
         self.os.rename(path0, path1)
         self.assertEqual(['Beta'], sorted(self.os.listdir(path0)))
 
+    def test_renames_creates_missing_dirs(self):
+        old_path = self.make_path("foo.txt")
+        self.create_file(old_path)
+        new_path = self.make_path("new", "dir", "bar.txt")
+        self.os.renames(old_path, new_path)
+        self.assertTrue(self.os.path.exists(new_path))
+        self.assertFalse(self.os.path.exists(old_path))
+
+    def test_renames_removes_empty_dirs(self):
+        old_base_path = self.make_path("old")
+        old_path = self.make_path("old", "dir1", "dir2", "foo.txt")
+        other_file = self.os.path.join(old_base_path, "foo.png")
+        self.create_file(old_path)
+        self.create_file(other_file)
+        new_path = self.make_path("new", "bar.txt")
+        self.os.renames(old_path, new_path)
+        self.assertTrue(self.os.path.exists(new_path))
+        self.assertFalse(self.os.path.exists(old_path))
+        self.assertTrue(self.os.path.exists(old_base_path))
+        removed_path = self.os.path.join(old_base_path, "dir1")
+        self.assertFalse(self.os.path.exists(removed_path))
+
     def test_stat_with_mixed_case(self):
         # Regression test for #310
         self.skip_if_symlink_not_supported()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/setup.py new/pyfakefs-4.7.0/setup.py
--- old/pyfakefs-4.6.3/setup.py 2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/setup.py 2022-09-18 11:58:45.000000000 +0200
@@ -83,7 +83,7 @@
     keywords=KEYWORDS,
     url=URL,
     classifiers=CLASSIFIERS,
-    python_requires='>=3.6',
+    python_requires='>=3.7',
     test_suite='pyfakefs.tests',
     packages=find_packages(exclude=['docs'])
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pyfakefs-4.6.3/tox.ini new/pyfakefs-4.7.0/tox.ini
--- old/pyfakefs-4.6.3/tox.ini  2022-07-20 20:43:14.000000000 +0200
+++ new/pyfakefs-4.7.0/tox.ini  2022-09-18 11:58:45.000000000 +0200
@@ -1,5 +1,5 @@
 [tox]
-envlist=py36,py37,py38,py39,py310,pypy3
+envlist=py37,py38,py39,py310,pypy3
 
 [testenv]
 deps =

Reply via email to