change tests to use explicit relative imports

This commit is contained in:
James Turk 2011-04-27 00:08:21 -04:00
parent 089f44e6ac
commit 92db17a3ed
6 changed files with 35 additions and 34 deletions

1
TODO
View File

@ -2,7 +2,6 @@ Someday
* have Window pass-through to Renderer * have Window pass-through to Renderer
Maybe Maybe
* better enum solution?
* pixel formats * pixel formats
* SDL_SysWM * SDL_SysWM
* Joystick * Joystick

View File

@ -1,52 +1,55 @@
import csdl from .. import (get_error, set_error, clear_error,
InitFlags, init, quit, was_init,
init_sub_system, quit_sub_system,
get_version, get_revision)
from nose.tools import with_setup from nose.tools import with_setup
def test_error_handling(): def test_error_handling():
# blank by default # blank by default
assert csdl.get_error() == "" assert get_error() == ""
# check set # check set
csdl.set_error("test!") set_error("test!")
assert csdl.get_error() == "test!" assert get_error() == "test!"
# check again, shouldn't clear # check again, shouldn't clear
assert csdl.get_error() == "test!" assert get_error() == "test!"
# clear again # clear again
csdl.clear_error() clear_error()
assert csdl.get_error() == "" assert get_error() == ""
@with_setup(csdl.quit) @with_setup(quit)
def test_init(): def test_init():
csdl.init(csdl.InitFlags.EVERYTHING) init(InitFlags.EVERYTHING)
# everything should include these # everything should include these
assert csdl.was_init(csdl.InitFlags.TIMER|csdl.InitFlags.AUDIO| assert was_init(InitFlags.TIMER|InitFlags.AUDIO|
csdl.InitFlags.VIDEO|csdl.InitFlags.JOYSTICK| InitFlags.VIDEO|InitFlags.JOYSTICK|
csdl.InitFlags.HAPTIC) InitFlags.HAPTIC)
@with_setup(csdl.quit) @with_setup(quit)
def test_quit(): def test_quit():
csdl.init(csdl.InitFlags.EVERYTHING) init(InitFlags.EVERYTHING)
csdl.quit() quit()
assert csdl.was_init(0) == 0 assert was_init(0) == 0
@with_setup(csdl.quit) @with_setup(quit)
def test_init_sub_system(): def test_init_sub_system():
csdl.init_sub_system(csdl.InitFlags.TIMER) init_sub_system(InitFlags.TIMER)
assert csdl.was_init(csdl.InitFlags.TIMER) assert was_init(InitFlags.TIMER)
@with_setup(csdl.quit) @with_setup(quit)
def test_quit_sub_system(): def test_quit_sub_system():
csdl.init_sub_system(csdl.InitFlags.TIMER) init_sub_system(InitFlags.TIMER)
assert csdl.was_init(csdl.InitFlags.TIMER) assert was_init(InitFlags.TIMER)
csdl.quit_sub_system(csdl.InitFlags.TIMER) quit_sub_system(InitFlags.TIMER)
assert not csdl.was_init(csdl.InitFlags.TIMER) assert not was_init(InitFlags.TIMER)
def test_version(): def test_version():
v = csdl.get_version() v = get_version()
assert repr(v).startswith('Version') assert repr(v).startswith('Version')
assert str(v).startswith('1.3') assert str(v).startswith('1.3')
assert v.major == 1 and v.minor == 3 assert v.major == 1 and v.minor == 3
def test_revision(): def test_revision():
assert csdl.get_revision().startswith('hg') assert get_revision().startswith('hg')

View File

@ -1,4 +1,4 @@
from csdl.enum import CEnum, CEnumSymbol from ..enum import CEnum, CEnumSymbol
import nose.tools import nose.tools
class TestEnum(CEnum): class TestEnum(CEnum):

View File

@ -1,7 +1,7 @@
from nose.tools import with_setup, raises from nose.tools import with_setup, raises
from csdl import init, InitFlags from .. import init, InitFlags
from csdl.internal import SDLError from ..internal import SDLError
from csdl.events import * from ..events import *
def get_mm_event(): def get_mm_event():
mm_event = MouseMotionEvent(type=EventType.MOUSEMOTION, mm_event = MouseMotionEvent(type=EventType.MOUSEMOTION,

View File

@ -1,4 +1,4 @@
from csdl import sysinfo from .. import sysinfo
def test_get_platform(): def test_get_platform():
assert isinstance(sysinfo.get_platform(), str) assert isinstance(sysinfo.get_platform(), str)

View File

@ -1,5 +1,4 @@
from csdl import init, InitFlags from .. import init, InitFlags, video
from csdl import video
from nose.tools import with_setup from nose.tools import with_setup
import time import time