Commit 96fe8ff9 authored by Clément Stenac's avatar Clément Stenac

Merge test/ stuff

parent 42088654
import vlc
import unittest
class BaseTestCase( unittest.TestCase ):
def testStartup(self):
"""Checks that VLC starts"""
mc = vlc.MediaControl( ['--quiet'])
mc.exit()
# def testHelp(self):
# """Check help string"""
# mc=vlc.MediaControl( [ '--help'] )
import vlc
import unittest
# FIXME: How to avoid creating / killing vlc for each test method ?
class VariablesTestCase( unittest.TestCase ):
"""Test misc variables interaction"""
def setUp( self ):
self.mc = vlc.MediaControl( [ '--quiet'] )
def tearDown( self ):
self.mc.exit()
def testSimple( self ):
"""Test simple add/remove"""
assert len( self.mc.playlist_get_list() ) == 0
self.mc.playlist_add_item( "test" )
assert len( self.mc.playlist_get_list() ) == 1
* Write wrapper around MediaControl with output redirection / use of logger interface + log checker (look for error in log and fail if any)
*
import vlc
import unittest
# FIXME: How to avoid creating / killing vlc for each test method ?
class VariablesTestCase( unittest.TestCase ):
"""Test misc variables interaction"""
def setUp( self ):
self.mc = vlc.MediaControl( [ '--quiet'] )
# FIXME ! - Get this through children test
self.libvlc = vlc.Object(1)
self.playlist = vlc.Object(268)
def tearDown( self ):
self.playlist.release()
self.libvlc.release()
self.mc.exit()
# The Python binding can't create variables, so just get default ones
def testInt( self ):
"""Get/Set integer variable"""
assert self.libvlc.get( "width" ) == 0
self.libvlc.set( "width", 42 )
assert self.libvlc.get( 'width' ) == 42
# FIXME: Python binding should listen to return value and raise exception
def testInvalidInt( self ):
"""Get/Set invalid integer"""
self.libvlc.set( "width" , 5 )
self.libvlc.set( "width", "foo" )
assert self.libvlc.get( "width" ) == -1
def testString( self ):
"""Get/Set string variable"""
assert self.libvlc.get( "open" ) == ''
self.libvlc.set( "open", "foo" )
assert self.libvlc.get( "open" ) == "foo"
"""Regression testing framework
This module will search for scripts in the same directory named
XYZtest.py. Each such script should be a test suite that tests a
module through PyUnit. (As of Python 2.1, PyUnit is included in
the standard library as "unittest".) This script will aggregate all
found test suites into one big test suite and run them all at once.
"""
import sys, os, re, unittest
def printAndRun( module ):
print "Running tests from module " + module.__name__;
return unittest.defaultTestLoader.loadTestsFromModule( module )
def regressionTest():
path = os.path.abspath(os.path.dirname(sys.argv[0]))
files = os.listdir(path)
test = re.compile("test.py$", re.IGNORECASE)
files = filter(test.search, files)
filenameToModuleName = lambda f: os.path.splitext(f)[0]
moduleNames = map(filenameToModuleName, files)
modules = map(__import__, moduleNames)
# load = unittest.defaultTestLoader.loadTestsFromModule
load = printAndRun
return unittest.TestSuite(map(load, modules))
if __name__ == "__main__":
unittest.main(defaultTest="regressionTest")
#! /bin/sh
# FIXME - Get real .so
cd ..
export PYTHONPATH=$PYTHONPATH:bindings/python/build/lib.linux-i686-2.3
python test/test.py -v
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment