summaryrefslogtreecommitdiff
path: root/unit_tests/test_utils.py
diff options
context:
space:
mode:
authorJason Pellerin <jpellerin@gmail.com>2007-03-26 14:15:08 +0000
committerJason Pellerin <jpellerin@gmail.com>2007-03-26 14:15:08 +0000
commit63880ec71d7460ec0b86f900882b214ac3185757 (patch)
tree3c804fec11f5e89268f8d09cd996434e0b6d6b27 /unit_tests/test_utils.py
parent8b50466396f82a2fe5f6e91ae42f9ba5b1edd5a2 (diff)
downloadnose-63880ec71d7460ec0b86f900882b214ac3185757.tar.gz
Cleaned up some tests, added real plugin managers
Diffstat (limited to 'unit_tests/test_utils.py')
-rw-r--r--unit_tests/test_utils.py56
1 files changed, 27 insertions, 29 deletions
diff --git a/unit_tests/test_utils.py b/unit_tests/test_utils.py
index 5f41282..c27d73a 100644
--- a/unit_tests/test_utils.py
+++ b/unit_tests/test_utils.py
@@ -1,34 +1,34 @@
import unittest
import nose
-import nose.case
-from nose.util import absfile
+from nose import case
+from nose.util import *
class TestUtils(unittest.TestCase):
def test_file_like(self):
- assert nose.file_like('a/file')
- assert nose.file_like('file.py')
- assert nose.file_like('/some/file.py')
- assert not nose.file_like('a.file')
- assert not nose.file_like('some.package')
- assert nose.file_like('a-file')
- assert not nose.file_like('test')
+ assert file_like('a/file')
+ assert file_like('file.py')
+ assert file_like('/some/file.py')
+ assert not file_like('a.file')
+ assert not file_like('some.package')
+ assert file_like('a-file')
+ assert not file_like('test')
def test_split_test_name(self):
- assert nose.split_test_name('a.package:Some.method') == \
+ assert split_test_name('a.package:Some.method') == \
(None, 'a.package', 'Some.method')
- assert nose.split_test_name('some.module') == \
+ assert split_test_name('some.module') == \
(None, 'some.module', None)
- assert nose.split_test_name('this/file.py:func') == \
+ assert split_test_name('this/file.py:func') == \
('this/file.py', None, 'func')
- assert nose.split_test_name('some/file.py') == \
+ assert split_test_name('some/file.py') == \
('some/file.py', None, None)
- assert nose.split_test_name(':Baz') == \
+ assert split_test_name(':Baz') == \
(None, None, 'Baz')
def test_split_test_name_windows(self):
# convenience
- stn = nose.split_test_name
+ stn = split_test_name
self.assertEqual(stn(r'c:\some\path.py:a_test'),
(r'c:\some\path.py', None, 'a_test'))
self.assertEqual(stn(r'c:\some\path.py'),
@@ -64,41 +64,39 @@ class TestUtils(unittest.TestCase):
def test_two(self):
pass
- foo_funct = nose.case.FunctionTestCase(baz)
+ foo_funct = case.FunctionTestCase(baz)
foo_functu = unittest.FunctionTestCase(baz)
- foo_mtc = nose.case.MethodTestCase(Foo, 'bar')
+ foo_mtc = case.MethodTestCase(Foo.bar)
me = absfile(__file__)
- self.assertEqual(nose.test_address(baz),
+ self.assertEqual(test_address(baz),
(me, __name__, 'baz'))
- assert nose.test_address(Foo) == (me, __name__, 'Foo')
- assert nose.test_address(Foo.bar) == (me, __name__,
+ assert test_address(Foo) == (me, __name__, 'Foo')
+ assert test_address(Foo.bar) == (me, __name__,
'Foo.bar')
- assert nose.test_address(f) == (me, __name__, 'Foo')
- assert nose.test_address(f.bar) == (me, __name__, 'Foo.bar')
- assert nose.test_address(nose) == (absfile(nose.__file__), 'nose')
+ assert test_address(f) == (me, __name__, 'Foo')
+ assert test_address(f.bar) == (me, __name__, 'Foo.bar')
+ assert test_address(nose) == (absfile(nose.__file__), 'nose')
# test passing the actual test callable, as the
# missed test plugin must do
- self.assertEqual(nose.test_address(FooTC('test_one')),
+ self.assertEqual(test_address(FooTC('test_one')),
(me, __name__, 'FooTC.test_one'))
- self.assertEqual(nose.test_address(foo_funct),
+ self.assertEqual(test_address(foo_funct),
(me, __name__, 'baz'))
- self.assertEqual(nose.test_address(foo_functu),
+ self.assertEqual(test_address(foo_functu),
(me, __name__, 'baz'))
- self.assertEqual(nose.test_address(foo_mtc),
+ self.assertEqual(test_address(foo_mtc),
(me, __name__, 'Foo.bar'))
def test_tolist(self):
- from nose.util import tolist
assert tolist('foo') == ['foo']
assert tolist(['foo', 'bar']) == ['foo', 'bar']
assert tolist('foo,bar') == ['foo', 'bar']
self.assertEqual(tolist('.*foo/.*,.1'), ['.*foo/.*', '.1'])
def test_try_run(self):
- from nose.util import try_run
import imp
def bar():