From b5f72c22612746a9ea2cc496924552fe9df5ee36 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 14 Apr 2013 18:42:13 -0500 Subject: [PATCH] timeside/__init__.py: simplify import, add tests to make sure we can get processors --- tests/test_list_processors.py | 58 +++++++++++++++++++++++++++++++++++ timeside/__init__.py | 19 +++++------- 2 files changed, 66 insertions(+), 11 deletions(-) create mode 100755 tests/test_list_processors.py diff --git a/tests/test_list_processors.py b/tests/test_list_processors.py new file mode 100755 index 0000000..2f04ce3 --- /dev/null +++ b/tests/test_list_processors.py @@ -0,0 +1,58 @@ +#! /usr/bin/env python + +from unit_timeside import * +import timeside +verbose = 0 + +class TestListCoreProcessors(TestCase): + """ test get list of processors """ + + def testHasSomeDecoders(self): + "has some decoders" + import timeside.encoder + procs = timeside.core.processors(timeside.api.IEncoder) + self.assertNotEquals(len(procs), 0) + + def testHasSomeEncoders(self): + "has some encoders" + import timeside.encoder + procs = timeside.core.processors(timeside.api.IEncoder) + self.assertNotEquals(len(procs), 0) + + def testHasSomeAnalyzers(self): + "has some analyzers" + import timeside.analyzer + procs = timeside.core.processors(timeside.api.IAnalyzer) + self.assertNotEquals(len(procs), 0) + + def testHasSomeGraphers(self): + "has some graphers" + import timeside.grapher + procs = timeside.core.processors(timeside.api.IGrapher) + self.assertNotEquals(len(procs), 0) + +class TestListProcessors(TestCase): + """ test get list of processors """ + + def testHasSomeDecoders(self): + "has some decoders" + procs = timeside.get_processors(timeside.api.IEncoder) + self.assertNotEquals(len(procs), 0) + + def testHasSomeEncoders(self): + "has some encoders" + procs = timeside.get_processors(timeside.api.IEncoder) + self.assertNotEquals(len(procs), 0) + + def testHasSomeAnalyzers(self): + "has some analyzers" + procs = timeside.get_processors(timeside.api.IAnalyzer) + self.assertNotEquals(len(procs), 0) + + def testHasSomeGraphers(self): + "has some graphers" + procs = timeside.get_processors(timeside.api.IGrapher) + self.assertNotEquals(len(procs), 0) + +if __name__ == '__main__': + unittest.main(testRunner=TestRunner()) diff --git a/timeside/__init__.py b/timeside/__init__.py index 549faa0..f5049b6 100644 --- a/timeside/__init__.py +++ b/timeside/__init__.py @@ -1,15 +1,12 @@ # -*- coding: utf-8 -*- -import timeside.api -import timeside.exceptions -import timeside.core -import timeside.component -import timeside.metadata -import timeside.decoder -import timeside.encoder -import timeside.grapher -import timeside.analyzer -import timeside.tools -from timeside.core import * +import api + +def get_processors(proc_type): + import timeside.decoder + import timeside.encoder + import timeside.grapher + import timeside.analyzer + return core.processors(proc_type) __version__ = '0.4.3' -- 2.39.5