Exemplo n.º 1
0
 def test_non_writable_dir(self):
     """testing a non-writable dir should result in 0.
     Only useful on Linux, and only if not-writable
     """
     non_writable_dir = "/usr"
     if os.path.isdir(non_writable_dir) and not os.access(non_writable_dir, os.W_OK):
         speed = diskspeedmeasure(non_writable_dir)
         assert speed == 0
Exemplo n.º 2
0
    def test_disk_speed(self):
        """ Test the normal use case: writable directory"""
        speed = diskspeedmeasure(SAB_CACHE_DIR)
        assert speed > 0.0
        assert isinstance(speed, float)

        # Make sure the test-file was cleaned up after the test
        assert not os.path.exists(os.path.join(SAB_CACHE_DIR, "outputTESTING.txt"))
Exemplo n.º 3
0
    def test_disk_speed(self):
        speed = diskspeedmeasure(SAB_CACHE_DIR)
        assert speed
        assert isinstance(speed, float)

        # Make sure the test-file was cleaned up after the test
        assert not os.path.exists(
            os.path.join(SAB_CACHE_DIR, "outputTESTING.txt"))
Exemplo n.º 4
0
def test_disk_performance():
    """ Test the incomplete-dir performance and enable
        Direct Unpack if good enough (> 40MB/s)
    """
    if diskspeedmeasure(sabnzbd.cfg.download_dir.get_path()) > 40:
        cfg.direct_unpack.set(True)
        logging.warning(T('Direct Unpack was automatically enabled.') + ' ' + T('Jobs will start unpacking during the downloading to reduce post-processing time. Only works for jobs that do not need repair.'))
    else:
        logging.info('Direct Unpack was not enabled, incomplete folder disk speed below 40MB/s')
    cfg.direct_unpack_tested.set(True)
    sabnzbd.config.save_config()
Exemplo n.º 5
0
def test_disk_performance():
    """ Test the incomplete-dir performance and enable
        Direct Unpack if good enough (> 40MB/s)
    """
    if diskspeedmeasure(sabnzbd.cfg.download_dir.get_path()) > 40:
        cfg.direct_unpack.set(True)
        logging.warning(T('Direct Unpack was automatically enabled.') + ' ' + T('Jobs will start unpacking during the downloading to reduce post-processing time. Only works for jobs that do not need repair.'))
    else:
        logging.info('Direct Unpack was not enabled, incomplete folder disk speed below 40MB/s')
    cfg.direct_unpack_tested.set(True)
    sabnzbd.config.save_config()
Exemplo n.º 6
0
 def test_file_not_dir_specified(self):
     """ testing a file should result in 0"""
     with tempfile.NamedTemporaryFile() as temp_file:
         speed = diskspeedmeasure(temp_file.name)
     assert speed == 0
     assert not os.path.exists(temp_file.name)
Exemplo n.º 7
0
 def test_non_existing_dir(self):
     """ testing a non-existing dir should result in 0"""
     speed = diskspeedmeasure("such_a_dir_does_not_exist")
     assert speed == 0