File: test_sneeze.py

package info (click to toggle)
nipy 0.1.2%2B20100526-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 11,992 kB
  • ctags: 13,434
  • sloc: python: 47,720; ansic: 41,334; makefile: 197
file content (28 lines) | stat: -rw-r--r-- 937 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

import os
from tempfile import mkdtemp
from shutil import rmtree

from nipy.testing import *
from sneeze import find_pkg, run_nose

import_strings = ["from nipype.interfaces.afni import To3d, ThreeDRefit",
                  "from nipype.interfaces import afni",
                  "import nipype.interfaces.afni",
                  "from nipype.interfaces import afni as af"]

def test_imports():
    dname = mkdtemp()
    fname = os.path.join(dname, 'test_afni.py')
    for impt in import_strings:
        fp = open(fname, 'w')
        fp.write(impt)
        fp.close()
        cover_pkg, module = find_pkg(fname)
        cmd = run_nose(cover_pkg, fname, dry_run=True)
        cmdlst = cmd.split()
        cmd = ' '.join(cmdlst[:4]) # strip off temporary directory path
        yield assert_equal, cmd, \
        'nosetests -sv --with-coverage --cover-package=nipype.interfaces.afni'
    if os.path.exists(dname):
        rmtree(dname)