File: test_compression_settings.py

package info (click to toggle)
ont-fast5-api 4.1.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 3,548 kB
  • sloc: python: 3,799; makefile: 153; sh: 13
file content (25 lines) | stat: -rw-r--r-- 939 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import unittest
from unittest.mock import patch
import os

from ont_fast5_api.compression_settings import register_plugin

class TestCheckCompression(unittest.TestCase):

    def test_register_plugin_no_prepend(self):
        # GIVEN a version of h5py that has the h5pl module
        with patch('h5py.h5pl', create=True) as mock:

            # WHEN h5py.h5pl doesn't have the prepend method
            del mock.prepend
            # and the hdf5 plugin path variable hasn't been set
            if 'HDF5_PLUGIN_PATH' in os.environ:
                del os.environ['HDF5_PLUGIN_PATH']
            self.assertTrue('HDF5_PLUGIN_PATH' not in os.environ)

            # THEN when we try and register the vbz plugin we fall back to setting
            # HDF5_PLUGIN_PATH (because we can't use prepend)
            plugin_path = register_plugin()
            self.assertTrue(os.environ['HDF5_PLUGIN_PATH'] == plugin_path)