File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from bpython .importcompletion import find_modules
2- import os
2+ import os , sys , tempfile
33
4- foo = find_modules (os .path .abspath ("./importtestfolder" ))
4+ with tempfile .TemporaryDirectory () as import_test_folder :
5+ try :
6+ os .chdir (import_test_folder )
7+ except :
8+ print ("Can't change the Current Working Directory" )
9+ sys .exit ()
510
6- for thing in foo :
7- print ("YIELD:" , thing )
11+ os .mkdir (os .path .join (os .getcwd (), "Level0" )
12+ try :
13+ os .chdir (Level0 )
14+ open ("__init__.py" , w )
15+ except OSError :
16+ print ("Can't change the Current Working Directory" )
17+ sys .exit ()
18+
19+ os .mkdir (os .path .join (os .getcwd (), "Level1" )
20+ try :
21+ os .chdir (Level1 )
22+ open ("__init__.py" , w )
23+ except OSError :
24+ print ("Can't change the Current Working Directory" )
25+ sys .exit ()
26+
27+ os .mkdir (os .path .join (os .getcwd (), "Level2" )
28+ try :
29+ os .chdir (Level2 )
30+ open ("__init__.py" , w )
31+ except OSError :
32+ print ("Can't change the Current Working Directory" )
33+ sys .exit ()
34+
35+ os .symlink (
36+ "import_test_folder/Level0/Level1" ,
37+ os .path .join (os .getcwd , "Level3" ),
38+ True ,
39+ )
40+
41+ foo = find_modules (os .path .abspath ("import_test_folder" ))
42+
43+ for thing in foo :
44+ print ("YIELD:" , thing )
You can’t perform that action at this time.
0 commit comments