Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
d7508240
Commit
d7508240
authored
Apr 27, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the file comparison test suite to the unit tests. Make tests a package.
parent
47451f5e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
13 deletions
+90
-13
lib/python/TAL/README.txt
lib/python/TAL/README.txt
+9
-7
lib/python/TAL/runtest.py
lib/python/TAL/runtest.py
+18
-6
lib/python/TAL/tests/__init__.py
lib/python/TAL/tests/__init__.py
+1
-0
lib/python/TAL/tests/run.py
lib/python/TAL/tests/run.py
+2
-0
lib/python/TAL/tests/test_files.py
lib/python/TAL/tests/test_files.py
+60
-0
No files found.
lib/python/TAL/README.txt
View file @
d7508240
...
@@ -41,15 +41,16 @@ defaults to tests/input/test01.xml.
...
@@ -41,15 +41,16 @@ defaults to tests/input/test01.xml.
Regression test
Regression test
---------------
---------------
There are unit test suites in the 'tests' subdirectory; these can be
run with tests/run.py. This should print the testcase names plus
progress info, followed by a final line saying "OK". It requires that
../unittest.py exists.
There are a number of test files in the 'tests' subdirectory, named
There are a number of test files in the 'tests' subdirectory, named
tests/input/test<number>.xml and tests/input/test<number>.html. The
tests/input/test<number>.xml and tests/input/test<number>.html. The
Python script ./runtest.py calls driver.main() for each test file, and
Python script ./runtest.py calls driver.main() for each test file, and
should print "<file> OK" for each one.
should print "<file> OK" for each one. These tests are also run as
part of the unit test suites, so tests/run.py is all you need.
In addition, there are unit test suites in the 'tests' subdirectory;
these can be run with tests/run.py. This should print a number of
testcase names plus progress info, ending with a line saying "OK".
It requires that ../unittest.py exists.
What's Here
What's Here
-----------
-----------
...
@@ -65,9 +66,10 @@ driver.py script to demonstrate TAL expansion
...
@@ -65,9 +66,10 @@ driver.py script to demonstrate TAL expansion
timer.py script to time various processing phases
timer.py script to time various processing phases
setpath.py hack to set sys.path and import ZODB
setpath.py hack to set sys.path and import ZODB
__init__.py empty file that makes this directory a package
__init__.py empty file that makes this directory a package
runtest.py Python script to run
regressi
on tests
runtest.py Python script to run
file-comparis
on tests
ndiff.py helper for runtest.py to produce diffs
ndiff.py helper for runtest.py to produce diffs
tests/ drectory with test files and output
tests/ drectory with test files and output
tests/run.py Python script to run all tests
Author and License
Author and License
------------------
------------------
...
...
lib/python/TAL/runtest.py
View file @
d7508240
...
@@ -118,9 +118,13 @@ def main():
...
@@ -118,9 +118,13 @@ def main():
opts
=
[]
opts
=
[]
args
=
sys
.
argv
[
1
:]
args
=
sys
.
argv
[
1
:]
quiet
=
0
quiet
=
0
unittesting
=
0
if
args
and
args
[
0
]
==
"-q"
:
if
args
and
args
[
0
]
==
"-q"
:
quiet
=
1
quiet
=
1
del
args
[
0
]
del
args
[
0
]
if
args
and
args
[
0
]
==
"-Q"
:
unittesting
=
1
del
args
[
0
]
while
args
and
args
[
0
][:
1
]
==
'-'
:
while
args
and
args
[
0
][:
1
]
==
'-'
:
opts
.
append
(
args
[
0
])
opts
.
append
(
args
[
0
])
del
args
[
0
]
del
args
[
0
]
...
@@ -136,8 +140,9 @@ def main():
...
@@ -136,8 +140,9 @@ def main():
sys
.
exit
(
1
)
sys
.
exit
(
1
)
errors
=
0
errors
=
0
for
arg
in
args
:
for
arg
in
args
:
print
arg
,
if
not
unittesting
:
sys
.
stdout
.
flush
()
print
arg
,
sys
.
stdout
.
flush
()
save
=
sys
.
stdout
,
sys
.
argv
save
=
sys
.
stdout
,
sys
.
argv
try
:
try
:
try
:
try
:
...
@@ -154,8 +159,11 @@ def main():
...
@@ -154,8 +159,11 @@ def main():
print
sys
.
exc_type
print
sys
.
exc_type
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
else
:
else
:
print
"Failed:"
if
unittesting
:
sys
.
stdout
.
flush
()
print
else
:
print
"Failed:"
sys
.
stdout
.
flush
()
traceback
.
print_exc
()
traceback
.
print_exc
()
continue
continue
head
,
tail
=
os
.
path
.
split
(
arg
)
head
,
tail
=
os
.
path
.
split
(
arg
)
...
@@ -176,9 +184,13 @@ def main():
...
@@ -176,9 +184,13 @@ def main():
else
:
else
:
actual
=
readlines
(
stdout
)
actual
=
readlines
(
stdout
)
if
actual
==
expected
:
if
actual
==
expected
:
print
"OK"
if
not
unittesting
:
print
"OK"
else
:
else
:
print
"not OK"
if
unittesting
:
print
else
:
print
"not OK"
errors
=
1
errors
=
1
if
not
quiet
and
expected
is
not
None
:
if
not
quiet
and
expected
is
not
None
:
showdiff
(
expected
,
actual
)
showdiff
(
expected
,
actual
)
...
...
lib/python/TAL/tests/__init__.py
0 → 100644
View file @
d7508240
"""Empty file to make this directory a Python package."""
lib/python/TAL/tests/run.py
View file @
d7508240
...
@@ -8,6 +8,7 @@ import test_htmlparser
...
@@ -8,6 +8,7 @@ import test_htmlparser
import
test_htmltalparser
import
test_htmltalparser
import
test_xmlparser
import
test_xmlparser
import
test_talinterpreter
import
test_talinterpreter
import
test_files
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
@@ -15,6 +16,7 @@ def test_suite():
...
@@ -15,6 +16,7 @@ def test_suite():
suite
.
addTest
(
test_htmltalparser
.
test_suite
())
suite
.
addTest
(
test_htmltalparser
.
test_suite
())
suite
.
addTest
(
test_xmlparser
.
test_suite
())
suite
.
addTest
(
test_xmlparser
.
test_suite
())
suite
.
addTest
(
test_talinterpreter
.
test_suite
())
suite
.
addTest
(
test_talinterpreter
.
test_suite
())
suite
.
addTest
(
test_files
.
test_suite
())
return
suite
return
suite
def
main
():
def
main
():
...
...
lib/python/TAL/tests/test_files.py
0 → 100755
View file @
d7508240
#! /usr/bin/env python1.5
"""Tests that run driver.py over input files comparing to output files."""
import
os
import
sys
import
glob
import
utils
import
unittest
from
TAL
import
runtest
class
FileTestCase
(
unittest
.
TestCase
):
def
__init__
(
self
,
file
,
dir
):
self
.
__file
=
file
self
.
__dir
=
dir
unittest
.
TestCase
.
__init__
(
self
)
def
runTest
(
self
):
sys
.
stdout
.
write
(
os
.
path
.
basename
(
self
.
__file
)
+
" "
)
sys
.
stdout
.
flush
()
sys
.
argv
=
[
""
,
"-Q"
,
self
.
__file
]
pwd
=
os
.
getcwd
()
try
:
try
:
os
.
chdir
(
self
.
__dir
)
runtest
.
main
()
finally
:
os
.
chdir
(
pwd
)
except
SystemExit
,
what
:
if
what
.
code
:
self
.
fail
(
"output for %s didn't match"
%
self
.
__file
)
try
:
script
=
__file__
except
NameError
:
script
=
sys
.
argv
[
0
]
def
test_suite
():
suite
=
unittest
.
TestSuite
()
dir
=
os
.
path
.
dirname
(
script
)
dir
=
os
.
path
.
abspath
(
dir
)
parentdir
=
os
.
path
.
dirname
(
dir
)
prefix
=
os
.
path
.
join
(
dir
,
"input"
,
"test*."
)
xmlargs
=
glob
.
glob
(
prefix
+
"xml"
)
xmlargs
.
sort
()
htmlargs
=
glob
.
glob
(
prefix
+
"html"
)
htmlargs
.
sort
()
args
=
xmlargs
+
htmlargs
if
not
args
:
sys
.
stderr
.
write
(
"Warning: no test input files found!!!
\
n
"
)
for
arg
in
args
:
case
=
FileTestCase
(
arg
,
parentdir
)
suite
.
addTest
(
case
)
return
suite
if
__name__
==
"__main__"
:
errs
=
utils
.
run_suite
(
test_suite
())
sys
.
exit
(
errs
and
1
or
0
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment