File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 11import collections
22from itertools import islice
33import os
4+ import shutil
45import socket
6+ import tempfile
57from six .moves import range
68
79try :
1113
1214from bpython ._py3compat import py3
1315from bpython import config , repl , cli , autocomplete
14- from bpython .test import MagicIterMock , mock
16+ from bpython .test import MagicIterMock , mock , FixLanguageTestCase as TestCase
1517
1618
1719def setup_config (conf ):
@@ -252,6 +254,25 @@ def test_current_line(self):
252254# TODO add tests for various failures without using current function
253255
254256
257+ class TestEditConfig (TestCase ):
258+ def setUp (self ):
259+ self .repl = FakeRepl ()
260+ self .repl .interact .confirm = lambda msg : True
261+ self .repl .interact .notify = lambda msg : None
262+ self .repl .config .editor = 'true'
263+
264+ def test_create_config (self ):
265+ tmp_dir = tempfile .mkdtemp ()
266+ try :
267+ config_path = os .path .join (tmp_dir , 'newdir' , 'config' )
268+ self .repl .config .config_path = config_path
269+ self .repl .edit_config ()
270+ self .assertTrue (os .path .exists (config_path ))
271+ finally :
272+ shutil .rmtree (tmp_dir )
273+ self .assertFalse (os .path .exists (config_path ))
274+
275+
255276class TestRepl (unittest .TestCase ):
256277
257278 def set_input_line (self , line ):
You can’t perform that action at this time.
0 commit comments