Add test script for yocto_css and call it from testscour.py

This commit is contained in:
JSCHILL1 2010-02-07 08:44:49 -06:00
parent 2275c46569
commit 34b06e310a
4 changed files with 39 additions and 4 deletions

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
SCOURVER="0.24" SCOURVER="0.25"
cd .. 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 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 cd scour

View file

@ -72,7 +72,7 @@ except ImportError:
pass pass
APP = 'scour' APP = 'scour'
VER = '0.24' VER = '0.25'
COPYRIGHT = 'Copyright Jeff Schiller, 2010' COPYRIGHT = 'Copyright Jeff Schiller, 2010'
NS = { 'SVG': 'http://www.w3.org/2000/svg', NS = { 'SVG': 'http://www.w3.org/2000/svg',

32
testcss.py Executable file
View file

@ -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()

View file

@ -20,9 +20,9 @@
# limitations under the License. # limitations under the License.
import unittest import unittest
import scour
import xml.dom.minidom import xml.dom.minidom
from svg_regex import svg_parser from svg_regex import svg_parser
from scour import scourXmlFile, scourString, parse_args, makeWellFormed
SVGNS = 'http://www.w3.org/2000/svg' SVGNS = 'http://www.w3.org/2000/svg'
@ -1013,4 +1013,7 @@ class DoNotStripDoctype(unittest.TestCase):
# TODO: write tests for --strip-xml-prolog # TODO: write tests for --strip-xml-prolog
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() testcss = __import__('testcss')
scour = __import__('__main__')
suite = unittest.TestSuite( map(unittest.defaultTestLoader.loadTestsFromModule, [testcss, scour]) )
unittest.main(defaultTest="suite")