Example #1
0
 def setUp(self):
     string = dals("""
     custom_channels:
       darwin: https://some.url.somewhere/stuff
       chuck: http://another.url:8080/with/path
     custom_multichannels:
       michele:
         - https://do.it.with/passion
         - learn_from_every_thing
       steve:
         - more-downloads
     migrated_custom_channels:
       darwin: s3://just/cant
       chuck: file:///var/lib/repo/
     migrated_channel_aliases:
       - https://conda.anaconda.org
     channel_alias: ftp://new.url:8082
     conda-build:
       root-dir: /some/test/path
     proxy_servers:
       http: http://user:[email protected]:8080
       https: none
       ftp:
       sftp: ''
       ftps: false
       rsync: 'false'
     aggressive_update_packages: []
     """)
     reset_context()
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string)))
     context._set_raw_data(rd)
Example #2
0
 def _get_expandvars_context(attr, config_expr, env_value):
     with mock.patch.dict(os.environ, {"TEST_VAR": env_value}):
         reset_context(())
         string = f"{attr}: {config_expr}"
         rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_round_trip_load(string)))
         context._set_raw_data(rd)
         return getattr(context, attr)
Example #3
0
 def setUp(self):
     string = dals("""
     custom_channels:
       darwin: https://some.url.somewhere/stuff
       chuck: http://another.url:8080/with/path
     custom_multichannels:
       michele:
         - https://do.it.with/passion
         - learn_from_every_thing
       steve:
         - more-downloads
     migrated_custom_channels:
       darwin: s3://just/cant
       chuck: file:///var/lib/repo/
     migrated_channel_aliases:
       - https://conda.anaconda.org
     channel_alias: ftp://new.url:8082
     conda-build:
       root-dir: /some/test/path
     proxy_servers:
       http: http://user:[email protected]:8080
       https: none
       ftp:
       sftp: ''
       ftps: false
       rsync: 'false'
     aggressive_update_packages: []
     """)
     reset_context()
     rd = odict(testdata=YamlRawParameter.make_raw_parameters(
         'testdata', yaml_load(string)))
     context._set_raw_data(rd)
Example #4
0
    def setUp(cls):
        string = dals("""
        custom_channels:
          darwin: https://some.url.somewhere/stuff
          chuck: http://user1:[email protected]:8080/t/tk-1234/with/path
          pkgs/anaconda: http://192.168.0.15:8080
        migrated_custom_channels:
          darwin: s3://just/cant
          chuck: file:///var/lib/repo/
          pkgs/anaconda: https://repo.continuum.io
        migrated_channel_aliases:
          - https://conda.anaconda.org
        channel_alias: ftp://new.url:8082
        default_channels:
          - http://192.168.0.15:8080/pkgs/anaconda
          - http://192.168.0.15:8080/pkgs/pro
          - http://192.168.0.15:8080/pkgs/msys2
        """)
        reset_context()
        rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string)))
        context._set_raw_data(rd)
        Channel._reset_state()

        cls.platform = context.subdir

        cls.DEFAULT_URLS = ['http://192.168.0.15:8080/pkgs/anaconda/%s' % cls.platform,
                            'http://192.168.0.15:8080/pkgs/anaconda/noarch',
                            'http://192.168.0.15:8080/pkgs/pro/%s' % cls.platform,
                            'http://192.168.0.15:8080/pkgs/pro/noarch',
                            'http://192.168.0.15:8080/pkgs/msys2/%s' % cls.platform,
                            'http://192.168.0.15:8080/pkgs/msys2/noarch',
                            ]
Example #5
0
    def setUpClass(cls):
        string = dals("""
        custom_channels:
          darwin: https://some.url.somewhere/stuff
          chuck: http://user1:[email protected]:8080/t/tk-1234/with/path
          pkgs/free: http://192.168.0.15:8080
        migrated_custom_channels:
          darwin: s3://just/cant
          chuck: file:///var/lib/repo/
          pkgs/free: https://repo.continuum.io
        migrated_channel_aliases:
          - https://conda.anaconda.org
        channel_alias: ftp://new.url:8082
        default_channels:
          - http://192.168.0.15:8080/pkgs/free
          - http://192.168.0.15:8080/pkgs/pro
          - http://192.168.0.15:8080/pkgs/msys2
        """)
        reset_context()
        rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string)))
        context._set_raw_data(rd)
        Channel._reset_state()

        cls.platform = context.subdir

        cls.DEFAULT_URLS = ['http://192.168.0.15:8080/pkgs/free/%s' % cls.platform,
                            'http://192.168.0.15:8080/pkgs/free/noarch',
                            'http://192.168.0.15:8080/pkgs/pro/%s' % cls.platform,
                            'http://192.168.0.15:8080/pkgs/pro/noarch',
                            'http://192.168.0.15:8080/pkgs/msys2/%s' % cls.platform,
                            'http://192.168.0.15:8080/pkgs/msys2/noarch',
                            ]
Example #6
0
 def test_signing_metadata_url_base(self):
     SIGNING_URL_BASE = "https://conda.example.com/pkgs"
     string = f"signing_metadata_url_base: {SIGNING_URL_BASE}"
     reset_context()
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_round_trip_load(string)))
     context._set_raw_data(rd)
     assert context.signing_metadata_url_base == SIGNING_URL_BASE
Example #7
0
 def test_client_ssl_cert(self):
     string = dals("""
     client_ssl_cert_key: /some/key/path
     """)
     reset_context()
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_round_trip_load(string)))
     context._set_raw_data(rd)
     pytest.raises(ValidationError, context.validate_configuration)
Example #8
0
 def test_client_ssl_cert(self):
     string = dals("""
     client_ssl_cert_key: /some/key/path
     """)
     reset_context()
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string)))
     context._set_raw_data(rd)
     pytest.raises(ValidationError, context.validate_configuration)
Example #9
0
 def test_channels_defaults_condarc(self):
     # no channels provided in cli
     reset_context(())
     string = dals("""
     channels: ['defaults', 'conda-forge']
     """)
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_round_trip_load(string)))
     context._set_raw_data(rd)
     assert context.channels == ('defaults', 'conda-forge')
Example #10
0
 def test_signing_metadata_url_base_empty_default_channels(self):
     string = dals("""
     default_channels: []
     """)
     reset_context()
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_round_trip_load(string)))
     context._set_raw_data(rd)
     assert len(context.default_channels) is 0
     assert context.signing_metadata_url_base is None
Example #11
0
 def test_specify_channels_cli_condarc(self):
     # When the channel have been specified in condarc, these channels
     # should be used along with the one specified
     reset_context((), argparse_args=AttrDict(channel=['conda-forge']))
     string = dals("""
     channels: ['defaults', 'conda-forge']
     """)
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_round_trip_load(string)))
     context._set_raw_data(rd)
     assert context.channels == ('defaults', 'conda-forge')
Example #12
0
 def test_specify_same_channels_cli_as_in_condarc(self):
     # When the channel have been specified in condarc, these channels
     # should be used along with the one specified
     # In this test, the given channel in cli is the same as in condarc
     # 'defaults' should not be added
     # See https://github.com/conda/conda/issues/10732
     reset_context((), argparse_args=AttrDict(channel=['conda-forge']))
     string = dals("""
     channels: ['conda-forge']
     """)
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_round_trip_load(string)))
     context._set_raw_data(rd)
     assert context.channels == ('conda-forge', )
Example #13
0
    def setUpClass(cls):
        string = dals("""
        channel_alias: https://10.2.3.4:8080/conda/t/tk-123-45
        migrated_channel_aliases:
          - https://conda.anaconda.org
          - http://10.2.3.4:7070/conda
        """)
        reset_context()
        rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string)))
        context._set_raw_data(rd)
        Channel._reset_state()

        cls.platform = context.subdir
Example #14
0
    def setUpClass(cls):
        string = dals("""
        default_channels:
           - http://test/conda/anaconda
        channels:
           - http://test/conda/anaconda-cluster
        """)
        reset_context()
        rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string)))
        context._set_raw_data(rd)
        Channel._reset_state()

        cls.platform = context.subdir
Example #15
0
    def setUpClass(cls):
        string = dals("""
        default_channels:
           - http://test/conda/anaconda
        channels:
           - http://test/conda/anaconda-cluster
        """)
        reset_context()
        rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string)))
        context._set_raw_data(rd)
        Channel._reset_state()

        cls.platform = context.subdir
Example #16
0
    def setUpClass(cls):
        string = dals("""
        channel_alias: https://10.2.3.4:8080/conda/t/tk-123-45
        migrated_channel_aliases:
          - https://conda.anaconda.org
          - http://10.2.3.4:7070/conda
        """)
        reset_context()
        rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string)))
        context._set_raw_data(rd)
        Channel._reset_state()

        cls.platform = context.subdir
Example #17
0
 def test_specify_different_channels_cli_condarc(self):
     """
     When the channel have been specified in condarc, these channels
     should be used along with the one specified
     In this test, the given channel in cli is different from condarc
     'defaults' should not be added
     """
     reset_context((), argparse_args=AttrDict(channel=['other']))
     string = dals("""
     channels: ['conda-forge']
     """)
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_round_trip_load(string)))
     context._set_raw_data(rd)
     assert context.channels == ('conda-forge', 'other')
Example #18
0
 def setUpClass(cls):
     channels_config = dals("""
     channels:
       - http://user22:[email protected]:8080
       
     whitelist_channels:
       - http://user22:[email protected]:8080
     
     custom_channels:
       unexpanded: http://user1:[email protected]:8080/with/path/t/tk-1234
       expanded: http://user33:[email protected]:8080/with/path/t/tk-1234
     """)
     reset_context()
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(channels_config)))
     context._set_raw_data(rd)
Example #19
0
 def setUpClass(cls):
     channels_config = dals("""
     channels:
       - http://user22:[email protected]:8080
       
     whitelist_channels:
       - http://user22:[email protected]:8080
     
     custom_channels:
       unexpanded: http://user1:[email protected]:8080/with/path/t/tk-1234
       expanded: http://user33:[email protected]:8080/with/path/t/tk-1234
     """)
     reset_context()
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(channels_config)))
     context._set_raw_data(rd)
Example #20
0
 def setUp(self):
     string = dals("""
     custom_channels:
       darwin: https://some.url.somewhere/stuff
       chuck: http://another.url:8080/with/path
     migrated_custom_channels:
       darwin: s3://just/cant
       chuck: file:///var/lib/repo/
     migrated_channel_aliases:
       - https://conda.anaconda.org
     channel_alias: ftp://new.url:8082
     conda-build:
       root-dir: /some/test/path
     """)
     reset_context()
     rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string)))
     context._set_raw_data(rd)
Example #21
0
    def setUpClass(cls):
        string = dals("""
        custom_channels:
          chuck: http://user1:[email protected]:8080/with/path/t/tk-1234
          chuck/subchan: http://user33:[email protected]:8080/with/path/t/tk-1234
        channel_alias: ftp://nm:[email protected]:8082/t/zyx-wvut/
        channels:
          - mickey
          - https://conda.anaconda.cloud/t/tk-12-token/minnie
          - http://dont-do:[email protected]/daffy/label/main
        default_channels:
          - http://192.168.0.15:8080/pkgs/anaconda
          - donald/label/main
          - http://us:[email protected]:8080/t/tkn-123/pkgs/r
        """)
        reset_context()
        rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string)))
        context._set_raw_data(rd)
        Channel._reset_state()

        cls.platform = context.subdir
Example #22
0
    def setUpClass(cls):
        string = dals("""
        custom_channels:
          chuck: http://user1:[email protected]:8080/with/path/t/tk-1234
          chuck/subchan: http://user33:[email protected]:8080/with/path/t/tk-1234
        channel_alias: ftp://nm:[email protected]:8082/t/zyx-wvut/
        channels:
          - mickey
          - https://conda.anaconda.cloud/t/tk-12-token/minnie
          - http://dont-do:[email protected]/daffy/label/main
        default_channels:
          - http://192.168.0.15:8080/pkgs/free
          - donald/label/main
          - http://us:[email protected]:8080/t/tkn-123/pkgs/r
        """)
        reset_context()
        rd = odict(testdata=YamlRawParameter.make_raw_parameters('testdata', yaml_load(string)))
        context._set_raw_data(rd)
        Channel._reset_state()

        cls.platform = context.subdir