change tests to use explicit relative imports
This commit is contained in:
parent
089f44e6ac
commit
92db17a3ed
1
TODO
1
TODO
@ -2,7 +2,6 @@ Someday
|
||||
* have Window pass-through to Renderer
|
||||
|
||||
Maybe
|
||||
* better enum solution?
|
||||
* pixel formats
|
||||
* SDL_SysWM
|
||||
* Joystick
|
||||
|
@ -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
|
||||
|
||||
def test_error_handling():
|
||||
# blank by default
|
||||
assert csdl.get_error() == ""
|
||||
assert get_error() == ""
|
||||
|
||||
# check set
|
||||
csdl.set_error("test!")
|
||||
assert csdl.get_error() == "test!"
|
||||
set_error("test!")
|
||||
assert get_error() == "test!"
|
||||
|
||||
# check again, shouldn't clear
|
||||
assert csdl.get_error() == "test!"
|
||||
assert get_error() == "test!"
|
||||
|
||||
# clear again
|
||||
csdl.clear_error()
|
||||
assert csdl.get_error() == ""
|
||||
clear_error()
|
||||
assert get_error() == ""
|
||||
|
||||
@with_setup(csdl.quit)
|
||||
@with_setup(quit)
|
||||
def test_init():
|
||||
csdl.init(csdl.InitFlags.EVERYTHING)
|
||||
init(InitFlags.EVERYTHING)
|
||||
# everything should include these
|
||||
assert csdl.was_init(csdl.InitFlags.TIMER|csdl.InitFlags.AUDIO|
|
||||
csdl.InitFlags.VIDEO|csdl.InitFlags.JOYSTICK|
|
||||
csdl.InitFlags.HAPTIC)
|
||||
assert was_init(InitFlags.TIMER|InitFlags.AUDIO|
|
||||
InitFlags.VIDEO|InitFlags.JOYSTICK|
|
||||
InitFlags.HAPTIC)
|
||||
|
||||
@with_setup(csdl.quit)
|
||||
@with_setup(quit)
|
||||
def test_quit():
|
||||
csdl.init(csdl.InitFlags.EVERYTHING)
|
||||
csdl.quit()
|
||||
assert csdl.was_init(0) == 0
|
||||
init(InitFlags.EVERYTHING)
|
||||
quit()
|
||||
assert was_init(0) == 0
|
||||
|
||||
@with_setup(csdl.quit)
|
||||
@with_setup(quit)
|
||||
def test_init_sub_system():
|
||||
csdl.init_sub_system(csdl.InitFlags.TIMER)
|
||||
assert csdl.was_init(csdl.InitFlags.TIMER)
|
||||
init_sub_system(InitFlags.TIMER)
|
||||
assert was_init(InitFlags.TIMER)
|
||||
|
||||
@with_setup(csdl.quit)
|
||||
@with_setup(quit)
|
||||
def test_quit_sub_system():
|
||||
csdl.init_sub_system(csdl.InitFlags.TIMER)
|
||||
assert csdl.was_init(csdl.InitFlags.TIMER)
|
||||
csdl.quit_sub_system(csdl.InitFlags.TIMER)
|
||||
assert not csdl.was_init(csdl.InitFlags.TIMER)
|
||||
init_sub_system(InitFlags.TIMER)
|
||||
assert was_init(InitFlags.TIMER)
|
||||
quit_sub_system(InitFlags.TIMER)
|
||||
assert not was_init(InitFlags.TIMER)
|
||||
|
||||
def test_version():
|
||||
v = csdl.get_version()
|
||||
v = get_version()
|
||||
assert repr(v).startswith('Version')
|
||||
assert str(v).startswith('1.3')
|
||||
assert v.major == 1 and v.minor == 3
|
||||
|
||||
def test_revision():
|
||||
assert csdl.get_revision().startswith('hg')
|
||||
assert get_revision().startswith('hg')
|
||||
|
@ -1,4 +1,4 @@
|
||||
from csdl.enum import CEnum, CEnumSymbol
|
||||
from ..enum import CEnum, CEnumSymbol
|
||||
import nose.tools
|
||||
|
||||
class TestEnum(CEnum):
|
||||
|
@ -1,7 +1,7 @@
|
||||
from nose.tools import with_setup, raises
|
||||
from csdl import init, InitFlags
|
||||
from csdl.internal import SDLError
|
||||
from csdl.events import *
|
||||
from .. import init, InitFlags
|
||||
from ..internal import SDLError
|
||||
from ..events import *
|
||||
|
||||
def get_mm_event():
|
||||
mm_event = MouseMotionEvent(type=EventType.MOUSEMOTION,
|
||||
|
@ -1,4 +1,4 @@
|
||||
from csdl import sysinfo
|
||||
from .. import sysinfo
|
||||
|
||||
def test_get_platform():
|
||||
assert isinstance(sysinfo.get_platform(), str)
|
||||
|
@ -1,5 +1,4 @@
|
||||
from csdl import init, InitFlags
|
||||
from csdl import video
|
||||
from .. import init, InitFlags, video
|
||||
from nose.tools import with_setup
|
||||
import time
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user