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 1
1
import collections
2
2
from itertools import islice
3
3
import os
4
+ import shutil
4
5
import socket
6
+ import tempfile
5
7
from six .moves import range
6
8
7
9
try :
11
13
12
14
from bpython ._py3compat import py3
13
15
from bpython import config , repl , cli , autocomplete
14
- from bpython .test import MagicIterMock , mock
16
+ from bpython .test import MagicIterMock , mock , FixLanguageTestCase as TestCase
15
17
16
18
17
19
def setup_config (conf ):
@@ -252,6 +254,25 @@ def test_current_line(self):
252
254
# TODO add tests for various failures without using current function
253
255
254
256
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
+
255
276
class TestRepl (unittest .TestCase ):
256
277
257
278
def set_input_line (self , line ):
You can’t perform that action at this time.
0 commit comments