prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Bring back parallel testing in tox.ini
  I forgot a flag in there while debugging.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `plasmapy/classes/sources/openpmd_hdf5.py`
  Content:
  ```
  1 import numpy as np
  2 import astropy.units as u
  3 try:
  4     import h5py
  5 except (ImportError, ModuleNotFoundError) as e:
  6     from plasmapy.optional_deps import h5py_import_error
  7     raise ImportError(h5py_import_error) from e
  8 
  9 from plasmapy.classes import GenericPlasma
  10 from plasmapy.classes.exceptions import DataStandardError
  11 
  12 import os
  13 from distutils.version import StrictVersion
  14 
  15 
  16 _OUTDATED_VERSION = "1.1.0"
  17 _NEWER_VERSION = "2.0.0"
  18 
  19 # This is the order what OpenPMD uses to store unit
  20 # dimensions for a record.
  21 _UNITS = (u.meter,
  22           u.kilogram,
  23           u.second,
  24           u.ampere,
  25           u.Kelvin,
  26           u.mol,
  27           u.candela)
  28 
  29 
  30 def _fetch_units(openPMD_dims):
  31     """
  32     Converts a collection of OpenPMD dimensions to astropy.units.
  33     """
  34 
  35     units = u.dimensionless_unscaled
  36     for factor, unit in zip(openPMD_dims, _UNITS):
  37         units *= (unit ** factor)
  38     units, *_ = units.compose()
  39     return units
  40 
  41 
  42 def _valid_version(openPMD_version,
  43                    outdated=_OUTDATED_VERSION, newer=_NEWER_VERSION):
  44     """
  45     Checks if the passed version is supported or not.
  46     """
  47 
  48     parsed_version = StrictVersion(openPMD_version)
  49     outdated_version = StrictVersion(outdated)
  50     newer_version = StrictVersion(newer)
  51     return outdated_version <= parsed_version < newer_version
  52 
  53 
  54 class HDF5Reader(GenericPlasma):
  55     def __init__(self, hdf5, **kwargs):
  56         """
  57         Core class for accessing various attributes on HDF5 files that
  58         are based on OpenPMD standards.
  59 
  60         Attributes
  61         ----------
  62         electric_field : `astropy.units.Quantity`
  63             An (x, y, z) array containing electric field data.
  64         charge_density : `astropy.units.Quantity`
  65             An array containing charge density data.
  66 
  67         Parameters
  68         ----------
  69         hdf5 : `str`
  70             Path to HDF5 file.
  71 
  72         References
  73         ----------
  74         .. [1] http://openpmd.org/
  75         """
  76 
  77         if not os.path.isfile(hdf5):
  78             raise FileNotFoundError(f"Could not find file: '{hdf5}'")
  79 
  80         h5 = h5py.File(hdf5)
  81         self.h5 = h5
  82 
  83         self._check_valid_openpmd_version()
  84 
  85         self.subname = tuple(self.h5['data'])[0]
  86 
  87     def _check_valid_openpmd_version(self):
  88         try:
  89             openPMD_version = self.h5.attrs["openPMD"].decode('utf-8')
  90             if _valid_version(openPMD_version):
  91                 return True
  92             else:
  93                 raise DataStandardError(f"We currently only support HDF5 versions"
  94                                         f"starting from v{_OUTDATED_VERSION} and "
  95                                         f"lower than v{_NEWER_VERSION}. You can "
  96                                         f"however convert your HDF5 to a supported "
  97                                         f"version. For more information; see "
  98                                         f"https://github.com/openPMD/openPMD-updater")
  99         except KeyError:
  100             raise DataStandardError("Input HDF5 file does not go on with "
  101                                     "standards defined by OpenPMD")
  102 
  103     @property
  104     def electric_field(self):
  105         path = f"data/{self.subname}/fields/E"
  106         if path in self.h5:
  107             units = _fetch_units(self.h5[path].attrs["unitDimension"])
  108             axes = [self.h5[path][axis]
  109                     for axis in self.h5[path]]
  110             return np.array(axes) * units
  111         else:
  112             raise AttributeError("No electric field data available "
  113                                  "in HDF5 file")
  114 
  115     @property
  116     def charge_density(self):
  117         path = f"data/{self.subname}/fields/rho"
  118         if path in self.h5:
  119             units = _fetch_units(self.h5[path].attrs["unitDimension"])
  120             return np.array(self.h5[path]) * units
  121         else:
  122             raise AttributeError("No charge density data available "
  123                                  "in HDF5 file")
  124 
  125     @property
  126     def magnetic_field(self):
  127         path = f"data/{self.subname}/fields/B"
  128         if path in self.h5:
  129             units = _fetch_units(self.h5[path].attrs["unitDimension"])
  130             axes = [self.h5[path][axis]
  131                     for axis in self.h5[path]]
  132             return np.array(axes) * units
  133         else:
  134             raise AttributeError("No magnetic field data available "
  135                                  "in HDF5 file")
  136 
  137     @property
  138     def electric_current(self):
  139         path = f"data/{self.subname}/fields/J"
  140         if path in self.h5:
  141             units = _fetch_units(self.h5[path].attrs["unitDimension"])
  142             axes = [self.h5[path][axis]
  143                     for axis in self.h5[path]]
  144             return np.array(axes) * units
  145         else:
  146             raise AttributeError("No electric current data available "
  147                                  "in HDF5 file")
  148 
  149     @classmethod
  150     def is_datasource_for(cls, **kwargs):
  151         if "hdf5" not in kwargs:
  152             return False
  153 
  154         hdf5 = kwargs.get("hdf5")
  155         openPMD = kwargs.get("openPMD")
  156 
  157         isfile = os.path.isfile(hdf5)
  158         if not isfile:
  159             raise FileNotFoundError(f"Could not find file: '{hdf5}'")
  160 
  161         if "openPMD" not in kwargs:
  162             h5 = h5py.File(hdf5)
  163             try:
  164                 openPMD = h5.attrs["openPMD"]
  165             except KeyError:
  166                 openPMD = False
  167 
  168         return openPMD
  169
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/plasmapy/classes/sources/openpmd_hdf5.py b/plasmapy/classes/sources/openpmd_hdf5.py
  --- a/plasmapy/classes/sources/openpmd_hdf5.py
  +++ b/plasmapy/classes/sources/openpmd_hdf5.py
  @@ -84,6 +84,15 @@
   
           self.subname = tuple(self.h5['data'])[0]
   
  +    def __enter__(self):
  +        return self.h5
  +
  +    def close(self):
  +        self.h5.close()
  +
  +    def __exit__(self):
  +        self.h5.close()
  +
       def _check_valid_openpmd_version(self):
           try:
               openPMD_version = self.h5.attrs["openPMD"].decode('utf-8')
  
verification_info: {"golden_diff": "diff --git a/plasmapy/classes/sources/openpmd_hdf5.py b/plasmapy/classes/sources/openpmd_hdf5.py\n--- a/plasmapy/classes/sources/openpmd_hdf5.py\n+++ b/plasmapy/classes/sources/openpmd_hdf5.py\n@@ -84,6 +84,15 @@\n \n         self.subname = tuple(self.h5['data'])[0]\n \n+    def __enter__(self):\n+        return self.h5\n+\n+    def close(self):\n+        self.h5.close()\n+\n+    def __exit__(self):\n+        self.h5.close()\n+\n     def _check_valid_openpmd_version(self):\n         try:\n             openPMD_version = self.h5.attrs[\"openPMD\"].decode('utf-8')\n", "issue": "Bring back parallel testing in tox.ini\nI forgot a flag in there while debugging.\n", "before_files": [{"content": "import numpy as np\nimport astropy.units as u\ntry:\n    import h5py\nexcept (ImportError, ModuleNotFoundError) as e:\n    from plasmapy.optional_deps import h5py_import_error\n    raise ImportError(h5py_import_error) from e\n\nfrom plasmapy.classes import GenericPlasma\nfrom plasmapy.classes.exceptions import DataStandardError\n\nimport os\nfrom distutils.version import StrictVersion\n\n\n_OUTDATED_VERSION = \"1.1.0\"\n_NEWER_VERSION = \"2.0.0\"\n\n# This is the order what OpenPMD uses to store unit\n# dimensions for a record.\n_UNITS = (u.meter,\n          u.kilogram,\n          u.second,\n          u.ampere,\n          u.Kelvin,\n          u.mol,\n          u.candela)\n\n\ndef _fetch_units(openPMD_dims):\n    \"\"\"\n    Converts a collection of OpenPMD dimensions to astropy.units.\n    \"\"\"\n\n    units = u.dimensionless_unscaled\n    for factor, unit in zip(openPMD_dims, _UNITS):\n        units *= (unit ** factor)\n    units, *_ = units.compose()\n    return units\n\n\ndef _valid_version(openPMD_version,\n                   outdated=_OUTDATED_VERSION, newer=_NEWER_VERSION):\n    \"\"\"\n    Checks if the passed version is supported or not.\n    \"\"\"\n\n    parsed_version = StrictVersion(openPMD_version)\n    outdated_version = StrictVersion(outdated)\n    newer_version = StrictVersion(newer)\n    return outdated_version <= parsed_version < newer_version\n\n\nclass HDF5Reader(GenericPlasma):\n    def __init__(self, hdf5, **kwargs):\n        \"\"\"\n        Core class for accessing various attributes on HDF5 files that\n        are based on OpenPMD standards.\n\n        Attributes\n        ----------\n        electric_field : `astropy.units.Quantity`\n            An (x, y, z) array containing electric field data.\n        charge_density : `astropy.units.Quantity`\n            An array containing charge density data.\n\n        Parameters\n        ----------\n        hdf5 : `str`\n            Path to HDF5 file.\n\n        References\n        ----------\n        .. [1] http://openpmd.org/\n        \"\"\"\n\n        if not os.path.isfile(hdf5):\n            raise FileNotFoundError(f\"Could not find file: '{hdf5}'\")\n\n        h5 = h5py.File(hdf5)\n        self.h5 = h5\n\n        self._check_valid_openpmd_version()\n\n        self.subname = tuple(self.h5['data'])[0]\n\n    def _check_valid_openpmd_version(self):\n        try:\n            openPMD_version = self.h5.attrs[\"openPMD\"].decode('utf-8')\n            if _valid_version(openPMD_version):\n                return True\n            else:\n                raise DataStandardError(f\"We currently only support HDF5 versions\"\n                                        f\"starting from v{_OUTDATED_VERSION} and \"\n                                        f\"lower than v{_NEWER_VERSION}. You can \"\n                                        f\"however convert your HDF5 to a supported \"\n                                        f\"version. For more information; see \"\n                                        f\"https://github.com/openPMD/openPMD-updater\")\n        except KeyError:\n            raise DataStandardError(\"Input HDF5 file does not go on with \"\n                                    \"standards defined by OpenPMD\")\n\n    @property\n    def electric_field(self):\n        path = f\"data/{self.subname}/fields/E\"\n        if path in self.h5:\n            units = _fetch_units(self.h5[path].attrs[\"unitDimension\"])\n            axes = [self.h5[path][axis]\n                    for axis in self.h5[path]]\n            return np.array(axes) * units\n        else:\n            raise AttributeError(\"No electric field data available \"\n                                 \"in HDF5 file\")\n\n    @property\n    def charge_density(self):\n        path = f\"data/{self.subname}/fields/rho\"\n        if path in self.h5:\n            units = _fetch_units(self.h5[path].attrs[\"unitDimension\"])\n            return np.array(self.h5[path]) * units\n        else:\n            raise AttributeError(\"No charge density data available \"\n                                 \"in HDF5 file\")\n\n    @property\n    def magnetic_field(self):\n        path = f\"data/{self.subname}/fields/B\"\n        if path in self.h5:\n            units = _fetch_units(self.h5[path].attrs[\"unitDimension\"])\n            axes = [self.h5[path][axis]\n                    for axis in self.h5[path]]\n            return np.array(axes) * units\n        else:\n            raise AttributeError(\"No magnetic field data available \"\n                                 \"in HDF5 file\")\n\n    @property\n    def electric_current(self):\n        path = f\"data/{self.subname}/fields/J\"\n        if path in self.h5:\n            units = _fetch_units(self.h5[path].attrs[\"unitDimension\"])\n            axes = [self.h5[path][axis]\n                    for axis in self.h5[path]]\n            return np.array(axes) * units\n        else:\n            raise AttributeError(\"No electric current data available \"\n                                 \"in HDF5 file\")\n\n    @classmethod\n    def is_datasource_for(cls, **kwargs):\n        if \"hdf5\" not in kwargs:\n            return False\n\n        hdf5 = kwargs.get(\"hdf5\")\n        openPMD = kwargs.get(\"openPMD\")\n\n        isfile = os.path.isfile(hdf5)\n        if not isfile:\n            raise FileNotFoundError(f\"Could not find file: '{hdf5}'\")\n\n        if \"openPMD\" not in kwargs:\n            h5 = h5py.File(hdf5)\n            try:\n                openPMD = h5.attrs[\"openPMD\"]\n            except KeyError:\n                openPMD = False\n\n        return openPMD\n", "path": "plasmapy/classes/sources/openpmd_hdf5.py"}], "after_files": [{"content": "import numpy as np\nimport astropy.units as u\ntry:\n    import h5py\nexcept (ImportError, ModuleNotFoundError) as e:\n    from plasmapy.optional_deps import h5py_import_error\n    raise ImportError(h5py_import_error) from e\n\nfrom plasmapy.classes import GenericPlasma\nfrom plasmapy.classes.exceptions import DataStandardError\n\nimport os\nfrom distutils.version import StrictVersion\n\n\n_OUTDATED_VERSION = \"1.1.0\"\n_NEWER_VERSION = \"2.0.0\"\n\n# This is the order what OpenPMD uses to store unit\n# dimensions for a record.\n_UNITS = (u.meter,\n          u.kilogram,\n          u.second,\n          u.ampere,\n          u.Kelvin,\n          u.mol,\n          u.candela)\n\n\ndef _fetch_units(openPMD_dims):\n    \"\"\"\n    Converts a collection of OpenPMD dimensions to astropy.units.\n    \"\"\"\n\n    units = u.dimensionless_unscaled\n    for factor, unit in zip(openPMD_dims, _UNITS):\n        units *= (unit ** factor)\n    units, *_ = units.compose()\n    return units\n\n\ndef _valid_version(openPMD_version,\n                   outdated=_OUTDATED_VERSION, newer=_NEWER_VERSION):\n    \"\"\"\n    Checks if the passed version is supported or not.\n    \"\"\"\n\n    parsed_version = StrictVersion(openPMD_version)\n    outdated_version = StrictVersion(outdated)\n    newer_version = StrictVersion(newer)\n    return outdated_version <= parsed_version < newer_version\n\n\nclass HDF5Reader(GenericPlasma):\n    def __init__(self, hdf5, **kwargs):\n        \"\"\"\n        Core class for accessing various attributes on HDF5 files that\n        are based on OpenPMD standards.\n\n        Attributes\n        ----------\n        electric_field : `astropy.units.Quantity`\n            An (x, y, z) array containing electric field data.\n        charge_density : `astropy.units.Quantity`\n            An array containing charge density data.\n\n        Parameters\n        ----------\n        hdf5 : `str`\n            Path to HDF5 file.\n\n        References\n        ----------\n        .. [1] http://openpmd.org/\n        \"\"\"\n\n        if not os.path.isfile(hdf5):\n            raise FileNotFoundError(f\"Could not find file: '{hdf5}'\")\n\n        h5 = h5py.File(hdf5)\n        self.h5 = h5\n\n        self._check_valid_openpmd_version()\n\n        self.subname = tuple(self.h5['data'])[0]\n\n    def __enter__(self):\n        return self.h5\n\n    def close(self):\n        self.h5.close()\n\n    def __exit__(self):\n        self.h5.close()\n\n    def _check_valid_openpmd_version(self):\n        try:\n            openPMD_version = self.h5.attrs[\"openPMD\"].decode('utf-8')\n            if _valid_version(openPMD_version):\n                return True\n            else:\n                raise DataStandardError(f\"We currently only support HDF5 versions\"\n                                        f\"starting from v{_OUTDATED_VERSION} and \"\n                                        f\"lower than v{_NEWER_VERSION}. You can \"\n                                        f\"however convert your HDF5 to a supported \"\n                                        f\"version. For more information; see \"\n                                        f\"https://github.com/openPMD/openPMD-updater\")\n        except KeyError:\n            raise DataStandardError(\"Input HDF5 file does not go on with \"\n                                    \"standards defined by OpenPMD\")\n\n    @property\n    def electric_field(self):\n        path = f\"data/{self.subname}/fields/E\"\n        if path in self.h5:\n            units = _fetch_units(self.h5[path].attrs[\"unitDimension\"])\n            axes = [self.h5[path][axis]\n                    for axis in self.h5[path]]\n            return np.array(axes) * units\n        else:\n            raise AttributeError(\"No electric field data available \"\n                                 \"in HDF5 file\")\n\n    @property\n    def charge_density(self):\n        path = f\"data/{self.subname}/fields/rho\"\n        if path in self.h5:\n            units = _fetch_units(self.h5[path].attrs[\"unitDimension\"])\n            return np.array(self.h5[path]) * units\n        else:\n            raise AttributeError(\"No charge density data available \"\n                                 \"in HDF5 file\")\n\n    @property\n    def magnetic_field(self):\n        path = f\"data/{self.subname}/fields/B\"\n        if path in self.h5:\n            units = _fetch_units(self.h5[path].attrs[\"unitDimension\"])\n            axes = [self.h5[path][axis]\n                    for axis in self.h5[path]]\n            return np.array(axes) * units\n        else:\n            raise AttributeError(\"No magnetic field data available \"\n                                 \"in HDF5 file\")\n\n    @property\n    def electric_current(self):\n        path = f\"data/{self.subname}/fields/J\"\n        if path in self.h5:\n            units = _fetch_units(self.h5[path].attrs[\"unitDimension\"])\n            axes = [self.h5[path][axis]\n                    for axis in self.h5[path]]\n            return np.array(axes) * units\n        else:\n            raise AttributeError(\"No electric current data available \"\n                                 \"in HDF5 file\")\n\n    @classmethod\n    def is_datasource_for(cls, **kwargs):\n        if \"hdf5\" not in kwargs:\n            return False\n\n        hdf5 = kwargs.get(\"hdf5\")\n        openPMD = kwargs.get(\"openPMD\")\n\n        isfile = os.path.isfile(hdf5)\n        if not isfile:\n            raise FileNotFoundError(f\"Could not find file: '{hdf5}'\")\n\n        if \"openPMD\" not in kwargs:\n            h5 = h5py.File(hdf5)\n            try:\n                openPMD = h5.attrs[\"openPMD\"]\n            except KeyError:\n                openPMD = False\n\n        return openPMD\n", "path": "plasmapy/classes/sources/openpmd_hdf5.py"}]}