def test():  # pragma: no cover
    """Main local test."""
    from conda_manager.utils.qthelpers import qapplication
    urls = [
        'https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2',
        'https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2',
        'https://conda.anaconda.org/anaconda/linux-64/repodata.json.bz2',
        'https://conda.anaconda.org/asmeurer/linux-64/repodata.json.bz2',
        'https://conda.anaconda.org/conda-forge/linux-64/repodata.json.bz2',
            ]
    path = os.sep.join([os.path.expanduser('~'), 'testing-download'])
    app = qapplication()
    api = RequestsDownloadAPI()

    for i, url in enumerate(urls):
        filepath = os.path.join(path, str(i) + '.json.bz2')
        worker = api.download(url, filepath)
        worker.sig_finished.connect(ready_print)
        print('Downloading', url, filepath)

#    path = os.sep.join([os.path.expanduser('~'), 'testing-download-requests'])
#    api = RequestsDownloadAPI()
#    urls += ['asdasdasdad']
#    for i, url in enumerate(urls):
#        worker = api.is_valid_url(url)
#        worker.url = url
#        worker.sig_finished.connect(ready_print)
#        filepath = os.path.join(path, str(i) + '.json.bz2')
#        worker = api.download(url, path=filepath, force=True)
#        worker.sig_finished.connect(ready_print)
#
#    api = RequestsDownloadAPI()
#    print(api._is_valid_api_url('https://api.anaconda.org'))
#    print(api._is_valid_api_url('https://conda.anaconda.org'))
#    print(api._is_valid_channel('https://google.com'))
#    print(api._is_valid_channel('https://conda.anaconda.org/continuumcrew'))
#    print(api.get_api_info('https://api.anaconda.org'))
    sys.exit(app.exec_())
def test ( ) : from conda_manager . utils . qthelpers import qapplication urls = [ 'https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2' , 'https://repo.continuum.io/pkgs/free/linux-64/repodata.json.bz2' , 'https://conda.anaconda.org/anaconda/linux-64/repodata.json.bz2' , 'https://conda.anaconda.org/asmeurer/linux-64/repodata.json.bz2' , 'https://conda.anaconda.org/conda-forge/linux-64/repodata.json.bz2' , ] path = os . sep . join ( [ os . path . expanduser ( '~' ) , 'testing-download' ] ) app = qapplication ( ) api = RequestsDownloadAPI ( ) for i , url in enumerate ( urls ) : filepath = os . path . join ( path , str ( i ) + '.json.bz2' ) worker = api . download ( url , filepath ) worker . sig_finished . connect ( ready_print ) print ( 'Downloading' , url , filepath ) sys . exit ( app . exec_ ( ) )
Main local test.