Changeset 3985

Show
Ignore:
Timestamp:
02/12/09 01:48:01 (4 years ago)
Author:
getxsick
Message:

* tests: added a test which check if all directories in .umpa are created

correctly (if .umpa exists!).
it's commented, see comment why

* fixed the bug related to this test

Location:
branch/UMPA
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branch/UMPA/tests/unit/test_init.py

    r3984 r3985  
    3232        cls.tmp_dir = tempfile.mkdtemp() 
    3333        os.path.expanduser = expanduser 
     34        # TODO: make a test for commented lines but clean .umpa and 
     35        # re-import umpa after creating dirs 
     36        #os.makedirs(os.path.join(cls.tmp_dir, '.umpa')) 
     37        #os.makedirs(os.path.join(cls.tmp_dir, '.umpa', 'umpa_plugins', 
     38        #                                                       'protocols')) 
    3439        import umpa 
    3540 
  • branch/UMPA/umpa/__init__.py

    r3981 r3985  
    4848local_path = os.path.join(os.path.expanduser('~'), '.umpa') 
    4949 
    50 # checking if local directory exists 
    51 if not os.path.isdir(local_path): 
    52     os.makedirs(os.path.join(local_path, 'umpa_plugins', 'protocols')) 
    53     os.mkdir(os.path.join(local_path, 'umpa_plugins', 'extensions')) 
     50for dir in ('protocols', 'extensions'): 
     51    try: 
     52        os.makedirs(os.path.join(local_path, 'umpa_plugins', dir)) 
     53    except OSError, err: 
     54        if err.errno != 17:     # skip if dir exists 
     55            raise 
    5456 
    5557# to allow things like: from umpa_plugins.extensions import something