def test_general_options(): a = options.General( concurrency=options.Concurrency( crypto_processes=1, md5_processes=2, disk_threads=3, transfer_threads=4, ), log_file='abc.log', progress_bar=False, resume_file='abc', timeout=options.Timeout(1, 2, None), quiet=True, dry_run=True, verbose=True, ) assert a.concurrency.crypto_processes == 1 assert a.concurrency.md5_processes == 2 assert a.concurrency.disk_threads == 3 assert a.concurrency.transfer_threads == 4 assert a.log_file == 'abc.log' assert not a.progress_bar assert a.resume_file == pathlib.Path('abc') assert a.timeout.timeout == (1, 2) assert a.timeout.max_retries is None assert a.quiet assert a.dry_run assert a.verbose a = options.General( concurrency=options.Concurrency( crypto_processes=1, md5_processes=2, disk_threads=3, transfer_threads=4, ), progress_bar=False, resume_file=None, timeout=options.Timeout(2, 1, 0), verbose=True, ) assert a.concurrency.crypto_processes == 1 assert a.concurrency.md5_processes == 2 assert a.concurrency.disk_threads == 3 assert a.concurrency.transfer_threads == 4 assert a.log_file is None assert not a.progress_bar assert a.resume_file is None assert a.timeout.timeout == (2, 1) assert a.timeout.max_retries == 0 assert not a.quiet assert not a.dry_run assert a.verbose with pytest.raises(ValueError): a = options.General(None)
def test_timeout(): a = options.Timeout(connect=None, read=1) assert a.connect == options._DEFAULT_REQUESTS_TIMEOUT[0] assert a.read == 1 assert a.timeout == (options._DEFAULT_REQUESTS_TIMEOUT[0], 1) a = options.Timeout(connect=2, read=0) assert a.connect == 2 assert a.read == options._DEFAULT_REQUESTS_TIMEOUT[1] assert a.timeout == (2, options._DEFAULT_REQUESTS_TIMEOUT[1])
def test_timeout(): a = options.Timeout(connect=None, read=1, max_retries=-1) assert a.connect == options._DEFAULT_REQUESTS_TIMEOUT[0] assert a.read == 1 assert a.timeout == (options._DEFAULT_REQUESTS_TIMEOUT[0], 1) assert a.max_retries is None a = options.Timeout(connect=2, read=0, max_retries=3) assert a.connect == 2 assert a.read == options._DEFAULT_REQUESTS_TIMEOUT[1] assert a.timeout == (2, options._DEFAULT_REQUESTS_TIMEOUT[1]) assert a.max_retries == 3