Beispiel #1
0
    def test_get_vexrc(self):
        options = main.get_options(['--config', 'pretends_to_exist'])

        def fake_open(name, mode):
            assert name == 'pretends_to_exist'
            assert mode == 'rb'
            return BytesIO(b'a=b\n')

        with patch('os.path.exists', return_value=True), \
             patch('vex.config.open', create=True, new=fake_open):
            vexrc = main.get_vexrc(options, {})
            assert vexrc
Beispiel #2
0
    def test_get_vexrc(self):
        options = main.get_options(['--config', 'pretends_to_exist'])

        def fake_open(name, mode):
            assert name == 'pretends_to_exist'
            assert mode == 'rb'
            return BytesIO(b'a=b\n')

        with patch('os.path.exists', return_value=True), \
             patch('vex.config.open', create=True, new=fake_open):
            vexrc = main.get_vexrc(options, {})
            assert vexrc
Beispiel #3
0
    def test_get_vexrc(self):
        options = main.get_options(["--config", "pretends_to_exist"])

        def fake_open(name, mode):
            assert name == "pretends_to_exist"
            assert mode == "rb"
            return BytesIO(b"a=b\n")

        with patch("os.path.exists", return_value=True), \
             patch("vex.config.open", create=True, new=fake_open):
            vexrc = main.get_vexrc(options, {})
            assert vexrc
Beispiel #4
0
 def test_get_vexrc_nonexistent(self):
     options = main.get_options(['--config', 'unlikely_to_exist'])
     try:
         main.get_vexrc(options, {})
     except exceptions.InvalidVexrc as error:
         assert 'unlikely_to_exist' in str(error)
Beispiel #5
0
 def test_get_vexrc_nonexistent(self):
     options = main.get_options(['--config', 'unlikely_to_exist'])
     try:
         main.get_vexrc(options, {})
     except exceptions.InvalidVexrc as error:
         assert 'unlikely_to_exist' in str(error)