Skip to content

Commit

Permalink
Make the two testing versions work for me. Just checking for
Browse files Browse the repository at this point in the history
z3c.ptcomat does not mean z3c.pt is available.
  • Loading branch information
strichter committed Jun 14, 2009
1 parent 39ff167 commit b04347b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/z3c/form/browser/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
from zope.testing.doctestunit import DocFileSuite

from z3c.form import testing
from z3c.form.ptcompat import AVAILABLE
from z3c.form.ptcompat import AVAILABLE, Z3CPT_AVAILABLE

def test_suite():
checker = testing.OutputChecker(doctest)

if AVAILABLE:
if AVAILABLE and Z3CPT_AVAILABLE:
setups = (testing.setUpZPT, testing.setUpZ3CPT)
else:
setups = (testing.setUpZPT,)
Expand Down
10 changes: 9 additions & 1 deletion src/z3c/form/ptcompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@

#import utilities from z3c.ptcompat when available and set AVAILABLE flag

AVAILABLE = False
Z3CPT_AVAILABLE = False

try:
from z3c.ptcompat import ViewPageTemplateFile
from z3c.ptcompat import bind_template
AVAILABLE = True
except ImportError:
AVAILABLE = False
from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
from zope.app.pagetemplate.viewpagetemplatefile import BoundPageTemplate \
as bind_template

try:
import z3c.pt
Z3CPT_AVAILABLE = True
except ImportError:
pass
4 changes: 2 additions & 2 deletions src/z3c/form/tests/test_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
from zope.app.testing import placelesssetup

from z3c.form import testing
from z3c.form.ptcompat import AVAILABLE
from z3c.form.ptcompat import AVAILABLE, Z3CPT_AVAILABLE

def test_suite():
checker = testing.OutputChecker(doctest)

if AVAILABLE:
if AVAILABLE and Z3CPT_AVAILABLE:
setups = (testing.setUpZPT, testing.setUpZ3CPT)
else:
setups = (testing.setUpZPT,)
Expand Down

0 comments on commit b04347b

Please sign in to comment.