Add mypy checks to CI

- see #599
diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml
index df96fa4..e2db8f4 100644
--- a/.github/workflows/pythonpackage.yml
+++ b/.github/workflows/pythonpackage.yml
@@ -19,10 +19,29 @@
     - name: Install linter
       run: |
         uname -a
-        python -m pip install flake8
+        python -m pip install flake8 mypy
     - name: Check syntax and style
       run: flake8 . --exclude get-pip.py --max-complexity=13 --statistics
 
+  mypy:
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest]
+        python-version:  [3.8]
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python-version }}
+      - name: Install dependencies
+        run: |
+          python -m pip install -r requirements.txt -r extra_requirements.txt
+          python -m pip install mypy==0.812
+      - name: Run typing checks
+        run: python -m mypy .
+
   tests:
     runs-on: ${{ matrix.os }}
     strategy:
diff --git a/CHANGES.md b/CHANGES.md
index 88b2c42..64c06f4 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -23,6 +23,9 @@
   * Update `fake_pathlib` to support changes coming in Python 3.10
     ([see](https://github.com/python/cpython/pull/19342))
 
+### Infrastructure
+  * added mypy checks in CI (see [#599](../../issues/599))
+
 ## [Version 4.4.0](https://pypi.python.org/pypi/pyfakefs/4.4.0) (2021-02-24)
 Adds better support for Python 3.8 / 3.9.
   
diff --git a/docs/usage.rst b/docs/usage.rst
index db52f5c..688ebeb 100644
--- a/docs/usage.rst
+++ b/docs/usage.rst
@@ -210,10 +210,8 @@
 
   @pytest.fixture
   def fs_no_root():
-      patcher = Patcher(allow_root_user=False)
-      patcher.setUp()
-      yield patcher.fs
-      patcher.tearDown()
+      with Patcher(allow_root_user=False) as patcher:
+          yield patcher.fs
 
   def test_something(fs_no_root):
       ...
diff --git a/pyfakefs/fake_filesystem_unittest.py b/pyfakefs/fake_filesystem_unittest.py
index e4ca8f1..7d41af5 100644
--- a/pyfakefs/fake_filesystem_unittest.py
+++ b/pyfakefs/fake_filesystem_unittest.py
@@ -745,7 +745,7 @@
             self._dyn_patcher = DynamicPatcher(self)
             sys.meta_path.insert(0, self._dyn_patcher)
             for module in self.modules_to_reload:
-                if module.__name__ in sys.modules:
+                if sys.modules.get(module.__name__) is module:
                     reload(module)
 
     def patch_functions(self):