예제 #1
0
파일: test_main.py 프로젝트: cwacek/vex
    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
예제 #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
예제 #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
예제 #4
0
파일: test_main.py 프로젝트: cwacek/vex
 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)
예제 #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)