From 34b06e310ae3c5b73892372f432b463f12deb5d1 Mon Sep 17 00:00:00 2001 From: JSCHILL1 Date: Sun, 7 Feb 2010 08:44:49 -0600 Subject: [PATCH] Add test script for yocto_css and call it from testscour.py --- package.sh | 2 +- scour.py | 2 +- testcss.py | 32 ++++++++++++++++++++++++++++++++ testscour.py | 7 +++++-- 4 files changed, 39 insertions(+), 4 deletions(-) create mode 100755 testcss.py diff --git a/package.sh b/package.sh index ec2fe7b..b6418b1 100755 --- a/package.sh +++ b/package.sh @@ -1,5 +1,5 @@ #!/bin/bash -SCOURVER="0.24" +SCOURVER="0.25" cd .. zip scour/tarballs/scour-$SCOURVER.zip scour/scour.py scour/yocto_css.py scour/svg_regex.py scour/LICENSE scour/NOTICE scour/README.txt scour/release-notes.html cd scour diff --git a/scour.py b/scour.py index b851e48..bcb0b38 100755 --- a/scour.py +++ b/scour.py @@ -72,7 +72,7 @@ except ImportError: pass APP = 'scour' -VER = '0.24' +VER = '0.25' COPYRIGHT = 'Copyright Jeff Schiller, 2010' NS = { 'SVG': 'http://www.w3.org/2000/svg', diff --git a/testcss.py b/testcss.py new file mode 100755 index 0000000..d6936e9 --- /dev/null +++ b/testcss.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# Test Harness for Scour +# +# Copyright 2010 Jeff Schiller +# +# This file is part of Scour, http://www.codedread.com/scour/ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest +from yocto_css import parseCssString + +class Blank(unittest.TestCase): + def runTest(self): + r = parseCssString('') + self.assertEquals( len(r), 0, 'Blank string returned non-empty list') + self.assertEquals( type(r), type([]), 'Blank string returned non list') + +if __name__ == '__main__': + unittest.main() diff --git a/testscour.py b/testscour.py index e4293ae..0683666 100755 --- a/testscour.py +++ b/testscour.py @@ -20,9 +20,9 @@ # limitations under the License. import unittest -import scour import xml.dom.minidom from svg_regex import svg_parser +from scour import scourXmlFile, scourString, parse_args, makeWellFormed SVGNS = 'http://www.w3.org/2000/svg' @@ -1013,4 +1013,7 @@ class DoNotStripDoctype(unittest.TestCase): # TODO: write tests for --strip-xml-prolog if __name__ == '__main__': - unittest.main() + testcss = __import__('testcss') + scour = __import__('__main__') + suite = unittest.TestSuite( map(unittest.defaultTestLoader.loadTestsFromModule, [testcss, scour]) ) + unittest.main(defaultTest="suite")