test_h5pl.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # This file is part of h5py, a Python interface to the HDF5 library.
  2. #
  3. # http://www.h5py.org
  4. #
  5. # Copyright 2008-2019 Andrew Collette and contributors
  6. #
  7. # License: Standard 3-clause BSD; see "license.txt" for full license terms
  8. # and contributor agreement.
  9. import pytest
  10. from h5py import h5pl
  11. from h5py.tests.common import insubprocess, subproc_env
  12. @pytest.mark.mpi_skip
  13. @insubprocess
  14. @subproc_env({'HDF5_PLUGIN_PATH': 'h5py_plugin_test'})
  15. def test_default(request):
  16. assert h5pl.size() == 1
  17. assert h5pl.get(0) == b'h5py_plugin_test'
  18. @pytest.mark.mpi_skip
  19. @insubprocess
  20. @subproc_env({'HDF5_PLUGIN_PATH': 'h5py_plugin_test'})
  21. def test_append(request):
  22. h5pl.append(b'/opt/hdf5/vendor-plugin')
  23. assert h5pl.size() == 2
  24. assert h5pl.get(0) == b'h5py_plugin_test'
  25. assert h5pl.get(1) == b'/opt/hdf5/vendor-plugin'
  26. @pytest.mark.mpi_skip
  27. @insubprocess
  28. @subproc_env({'HDF5_PLUGIN_PATH': 'h5py_plugin_test'})
  29. def test_prepend(request):
  30. h5pl.prepend(b'/opt/hdf5/vendor-plugin')
  31. assert h5pl.size() == 2
  32. assert h5pl.get(0) == b'/opt/hdf5/vendor-plugin'
  33. assert h5pl.get(1) == b'h5py_plugin_test'
  34. @pytest.mark.mpi_skip
  35. @insubprocess
  36. @subproc_env({'HDF5_PLUGIN_PATH': 'h5py_plugin_test'})
  37. def test_insert(request):
  38. h5pl.insert(b'/opt/hdf5/vendor-plugin', 0)
  39. assert h5pl.size() == 2
  40. assert h5pl.get(0) == b'/opt/hdf5/vendor-plugin'
  41. assert h5pl.get(1) == b'h5py_plugin_test'
  42. @pytest.mark.mpi_skip
  43. @insubprocess
  44. @subproc_env({'HDF5_PLUGIN_PATH': 'h5py_plugin_test'})
  45. def test_replace(request):
  46. h5pl.replace(b'/opt/hdf5/vendor-plugin', 0)
  47. assert h5pl.size() == 1
  48. assert h5pl.get(0) == b'/opt/hdf5/vendor-plugin'
  49. @pytest.mark.mpi_skip
  50. @insubprocess
  51. @subproc_env({'HDF5_PLUGIN_PATH': 'h5py_plugin_test'})
  52. def test_remove(request):
  53. h5pl.remove(0)
  54. assert h5pl.size() == 0